I was studying the code in txcommon/haystack_utils.py, when I came
across this line:
filters.append(SQ(slug='%s^1.2' % w))
I am unable to understand the utility of '^1.2'.
Here's the link to the code:
https://bitbucket.org/indifex/transifex/src/0e4bc50d840f/transifex/txcommon/haystack_utils.py#cl-45
--
Thanks
Regards,
Sayan Chowdhury
Third year, Computer Science and Engineering Department,
Dr.B.C.Roy Engineering College, Durgapur
http://fosswithme.wordpress.com
On Thu, Jan 12, 2012 at 12:19 PM, Sayan Chowdhury
<sayanch...@fedoraproject.org> wrote:
> Hi,
>
> I was studying the code in txcommon/haystack_utils.py, when I came
> across this line:
> filters.append(SQ(slug='%s^1.2' % w))
>
> I am unable to understand the utility of '^1.2'.
First off, note that this is related to the django-haystack
SearchQuerySet and not the Django ORM. That's why you might
have got confused.
FWIW for the SOLR search engine we use, when you do a search
in more than one field, you can boost the fields to have different
importance. I.e.:
SearchQuerySet().filter(SQ(slug='foo^1.3') || SQ(name='foo^1.2'))
The line above searches for the keyword 'foo' using two fields, 'slug'
and 'name'. As the field slug has a bigger booster then name,
matches on that field are considered more relevant, coming first in
the search result.
Hope it's clear now. :)
--
Diego Búrigo Zacarão