You'd have to split() the string (probably on spaces, though I don't
know exactly what you're going for,) then build a query that checks
for each piece OR'd with every other piece.  That would probably be
the best way--check out:
http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

A simpler way (also naive) would be this:
Entry.objects.filter(headline__in='Today Lennon Honoured'.split())

If you decide to go with the first approach, let me know--I can help
you with the syntax.

-Jeff

On Mar 4, 8:01 am, koranthala <koranth...@gmail.com> wrote:
> Hi,
>      How do I implement a substring query?
>      Please find the example below.
> From Django Documentation:
>   Entry.objects.get(headline__icontains='Lennon')
>   => This matches the headline 'Today lennon honoured'
>
> My query is the opposite:
>    I have the string 'Lennon' inside my DB, and I have to match 'Today
> Lennon honoured'
> Say:
> Entry.objects.get(headline__isubstring='Today Lennon Honoured')
> should return headline 'Lennon'.
>
>     I checked iregex too, but I cannot seem to solve it myself. If
> somebody has solved this, could you please help me out.
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to