David Balmain wrote:
> On 7/10/06, BlueJay <[EMAIL PROTECTED]> wrote:
>> many results there are in total before the user clicks on the item. For
>> example in the pull down I want to display "Fishing (10001), Shooting
>> (2003)".
> 
> Hi Clare,
> The fastest way to do this would be to run the query multiple times.
> So for your "sport" example you'd do something like this;
> 
>     fishing_count = index.search_each("sport AND fishing", :num_docs => 
> 1) {}
>     shooting_count = index.search_each("sport AND shooting", :num_docs 
> => 1) {}
>     # etc.
> 
> Then go ahead and paginate your query as you usually would.
> 

Thank you very much for your quite response.

I have several sub categories (taxonomy really) and what I was thinking 
of doing was this in 2 queries. Index the data as per normal so that you 
can do the full text search but also index the structure of the taxonomy 
and have each branch contain the records that contain it.
Run one big search over the fulltext to get the list of hits and then 
use this list as a query against the second index to get all the 
category bits.

This would be a big query though - although it should be quick but I 
would need to re-index the category bits everytime a document was added.

Does this make sense and/or would it make sense in Ferret. I have done 
this before in another search engine that required special category 
manipulation but never with Ferret and not sure how to go about doing 
this in Ferret.

I am not sure about your idea around filtering the results




>> I was going to do this in Ruby by doing a simple count for each category
>> item on the returned result set, but I believe that this would mean
>> returning all the results of a given query to Ruby in order to do this
>> count and I am concerned that this would cause performance issues for
>> large result sets.
> 
> Quite possibly. But running the query multiple times should be fine in
> terms of performance. You could use filters instead of the code I
> demonstrated above to further improve performance.
> 
>> If I put pagination into the mix and only display the first 50 results
>> on the screen, would this add an additional complexity or would this
>> just be called through Ruby?
>>
>> Thanks for your assistance with this...
> 
> I'm not exactly sure what you mean here when you say "would this be
> called through ruby". I hope I've already answered your question. Let
> me know if I didn't.
> 
> Cheers,
> Dave


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

Reply via email to