What's the django way to define indexes for tables?

I was surprised to see that there is no IndexField (I know field in not
the 'correct' terminology) or similar for django models. The 'search'
operator in the db api seems to limited to a sigle field and requires
the developer to define the index himself.

It would be great if there was a FullTextIndex object that you could
use in your model like this:

class Person(models.Model);
  firstname = CharField()
  middlename = CharField()
  lastname = CharField()
  nameindex = FullText(firstname, middlename, lastname)

The you could do something like
Person.objects.filter(nameindex__search='will') and it would search a
FullText index of the combined fields.

Something like that should not be very difficult to put together, and
it could easily be expanded to support other kinds of indices. I have a
need for it in a project I am working on and already worked out a few
(ugly) hacks.

I would like to know if any one else is working on something similar,
or any other thoughts you may have. I have seen the Merquery stuff, but
know little about it.

Thanks much
-mthorley


--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to