David Balmain wrote:

> Well the user would just type their query as usual but you'd write the
> query something like:
> 
> Books.find("pages match '#{query}'", :limit => 10)
> 
> Or something like that. I haven't worked the details yet. And you
> would be able to specify whether you wanted lazy or eager loading too.

That's what I guessed you'd have to do.  Change the query language to 
support this concept.  I was actually working on adding a new method to 
acts_as_ferret where you could pass these associations matches in like:

Book.find_by_association( query, [:pages], { :limit => 20 } )

Since I can't change the query language, but I could express the same 
sort of behavior.  This would result in a multi_index query across Book 
and Page indexes.  But, tracking total_hits, and paging just don't work 
with this approach.  The only option you have is to iterate over all the 
matches.

When we do ferret queries does ferret actually go over the entire search 
space to calculate all the possible documents that matched the query? 
Then just returns the ones within the offset and limits?

If that's the case then it's doable to create this type of search, but 
it would make more sense to modify ferret to support this type of query.

I'm interested in your database approach. It could help simplify this 
problem.  It seems doable to add this to acts_as_ferret without needing 
a seperate project.  Not to mention it's really needed in Rails apps as 
well.

Charlie

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to