On 10/4/06, Tom Smith <[EMAIL PROTECTED]> wrote:
>
> If I am looking for titles like "Anal Sex" or "Being Anal" then how
> do I construct this, ahem, query... to not return "Analysis" or
> "Analog"?

Two options: If your database supports it, try a full-text search:

object_list = Products.objects.filter(title__search=word)

Another option: MySQL at least has a REGEX search. To use it:

object_list = Products.objects.extra(where=["title REGEX %s"],
params=[r"\b%s\b" % word])

Above is untested in Django, but it should be what you want. \b
matches word boundaries.

-- 
This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to