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

Great. A word or warning though, it's all new code and you'll be
riding on the bleeding edge. But hopefully it will stabalize quickly.
I'm working on this full time at the moment (when I'm not answering
emails ;-)).

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

Reply via email to