thank you dennis,

what you suggested is a difficult process where we need to look into
performance its the query gets more complex and database gets bigger which
is obvious.

but its a good idea. i will try that for a while.

With Best
-Ashwin.
+91-9959166266


On Sun, Feb 3, 2013 at 11:54 PM, Dennis Lee Bieber <[email protected]>wrote:

> On Sun, 3 Feb 2013 13:11:55 +0530, Ashwin Kumar <[email protected]>
> declaimed the following in gmane.comp.python.django.user:
>
> > thank you joey,
> >
> > but i want to build search for queries like
> >
> >
> >    1. restaurants in city1
> >    2. city1 restaurants
> >    3. Chinese restaurants
> >    4. Chinese restaurants in city1
> >    5. vegetarian restaurants in city1
> >    6. vegetarian american restaurants
> >
> > the above are exact search queries we get from template.
> > i wrote
> > restas = restaurant.objects.filter(Q(name__contains =
> > request.REQUEST.get('title')) & ~Q(city__name='') )
> > this works fine to search with restaurant name.
> >
> >  i really have no idea on how to get results if the search phrase is
> > complex.
> >
>         I've not been following, and don't know the schema, but for such
> searches I suspect you'll have to bypass Django's ORM and go to direct
> SQL...
>
>         You'd split the search on words, skip the noise terms ("in", "and",
> "the", etc.), and then create a select statement in which you've created
> a test for each remaining word:
>
> select ... from ...
> where field contains <word1> and field contains <word2> and ...
>
>         If you have two (or more) fields that need to be matched, it gets
> more complex (unless you build a separate index containing terms from
> all relevant fields).
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         [email protected]    HTTP://wlfraed.home.netcom.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to