David Balmain wrote:
> > I think I finally understand what you want now and I do think this is
> the way to go. What you will need to do is build BitVectors for each
> of your categories and sub-categories using the examples in those
> those threads. Or you could just use a QueryFilter.
> 
>     filter = QueryFilter.new(PrefixQuery.new(:category, "fishing")))
>     fishing_bits = filter.bits(index_reader)
> 
>     filter = QueryFilter.new(PrefixQuery.new(:category, 
> "fishing/fiction")))
>     fishing_fiction_bits = filter.bits(index_reader)
> 
>     filter = QueryFilter.new(PrefixQuery.new(:category, 
> "fishing/nonfiction")))
>     fishing_nonfiction_bits = filter.bits(index_reader)
> 
> This assumes that everything in fishing/fiction is also in fishing/.
> In your example, it doesn't seem to be the case, so you should use a
> TermQuery instead of a PrefixQuery.
> 
> Now you just need to run your search the same way. Something like this;
> 
>     query = query_parser.parse(query_str)
>     query_bits = QueryFilter.new(query).bits(index_reader)
> 
> And now you can get your counts like this;
> 
>     fishing_count = (fishing_bits & query_bits).count
>     fishing_fiction_count = (fishing_fiction_bits & query_bits).count
>     fishing_nofiction_count = (fishing_nonfiction_bits & 
> query_bits).count
> 
> Sadly, this code only works in theory since I haven't release the code
> that &s bit vectors yet and I used the new style PrefixQuery
> declarations so they won't work either. But if this solution seems
> like it will work for you and you can wait a week, you'll be set.
> 
> Cheers,
> Dave

Dave

Thanks very much for this and I can wait a week for this to be released. 
I am sorry if I was not clear about this but everything in the sub 
categories will have to be in the category above as this is the way that 
the system is designed.

Fishing contains documents A B C D E F G H I J
Fishing_Fiction contains A B C
Fishing_Non_Fiction contains D and E
Fishing_Fiction_New contains A B
Fishing_Fiction_Old contains C
etc.

I am assuming that I need to still wait in this case? I will try and 
understand this in more detail in the meantime.

Thanks once again for all your assistance.

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

Reply via email to