On 2/7/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> User.objects.filter(first_name__sounds_like="John")
>
> which would produce and SQL statement like:
>
> WHERE DIFF(SOUNDEX(first_name), SOUNDEX("John")) >= 3
>
> Any plans for it?

As a built-in, probably not -- it is indeed somewhat db-specific, and
if we started added magic lookups for every possible query type we'd
never get anything else done. Luckily, it's very easy to do manually::

    User.objects.extra(
        where=["DIFF SOUNDEX(first_name), SOUNDEX(%s)) >=3"],
        params=["John"]
    )

Jacob

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

  • Soundex [EMAIL PROTECTED]
    • Re: Soundex Jacob Kaplan-Moss

Reply via email to