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".

filter(column__search=...) already exists, it's just extremely limited  
in its current state.

>
> # 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.

Thanks for the feedback,

Ben


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