On 7/10/06, BlueJay <[EMAIL PROTECTED]> wrote:
> 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.

I'm not sure what you mean by "category bits". Can you possible
implement the categories like this;

sport/
sport/shooting/
sport/fishing/
sport/fishing/fly
sprot/fishing/deep_sea
etc.

Then, lets say you have a query in query_str. You can get all results
in the sport category like this;

    index.search_each(query_str + "AND category:sport/*") {
        # ...
    }

You can get all results in the fishing category like this;

    index.search_each(query_str + "AND category:sport/fishing/*") {
        # ...
    }

Am I making sense?

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

You've lost me. Could you give some example code?

> 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'll explain filtering once I understand better what it is you are trying to do.

Cheers,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to