On Thu, Apr 23, 2009 at 6:50 PM, Ben Firshman <[email protected]> wrote:

>
> On 19 Apr 2009, at 11:42, mrts wrote:
> >
> > The feature is much needed, thanks for dealing with this!
> >
> > However, as for the API, I'd say coupling search to models is
> > inadvisable, Django has moved away from that design.
> >
> > A registry-based approach could be implemented:
>
> I agree this approach is better for external engines, but when just
> using SQL indexes, it makes a whole load of sense for it to be
> included in the ORM. I see "search_index" as just an extension of
> "db_index" and "unique".
>

Not to mention GeoDjango's spatial_index argument. There's certainly prior
art here. I agree that this approach would be entirely inappropriate for
solr, xapian, whoosh, etc. but it makes sense for SQL. Ben and I have
discussed this stuff at length over the last year, and I'm behind him 100%
on the design.


> # search in all registered models
> >>>> search.all().query('alpha')
> > [<Article: Django 1.1 alpha 1 released>, <Article: Django 1.1 beta
> > released>]
> >
> >>>> search.model(Article, Book).query('alpha')
> > [<Article: Django 1.1 alpha 1 released>, <Article: Django 1.1 beta
> > released>]
>
> Using SQL, there's no straight forward way of searching over multiple
> models. It could be done with another generic "document" model updated
> by signals, but this depends entirely on what fields you want to
> search over or filter by, so is quite site specific. I suppose some
> sort of magic abstract model could be provided if there is a need.


Not surprisingly, I agree with Ben on this too. Taking the registry +
post_save signals approach might make a useful third party app, but I don't
think it really needs to go into django proper. It really isn't that hard to
do on your own either.

Joseph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to