On Jun 16, 2006, at 3:08 PM, Sergei Serdyuk wrote:
> Thank you Erik. It is not clear to me what it would look like in  
> Ferret,
> but it sounds like a good direction to dig in.

In Java, building up such filters is done with code like this:

       TermEnum termEnum = reader.terms(new Term(field, ""));
       while (true) {
         Term term = termEnum.term();
         if (term == null || !term.field().equals(field)) break;

         termDocs.seek(term);
         OpenBitSet bitSet = new OpenBitSet(reader.numDocs());
         while (termDocs.next()) {
           bitSet.set(termDocs.doc());
         }

         // ... cache bitSet for future use ...

         if (! termEnum.next()) break;
       }

Ferret has a comparable API underneath that should make this sort of  
thing feasible in pure Ruby somehow.

        Erik


>
>> Erik Hatcher wrote:
>> I'm not familiar enough with Ferret, but I do this sort filtering and
>> set intersections with Java Lucene, primarily using Solr, from a Ruby
>> on Rails front-end.
>>
>> I build up bit sets (using Solr's new OpenBitSet class) that
>> represent "all items collected" and apply that filter to searches and
>> also intersect (using bit set ANDing) with other sets such as "all
>> objects from 1861" and "all poetry genre objects", and so on.  I've
>> also customized Solr to return back facet counts, so given your
>> example it could show how many books were in stock in each category
>> and allow you to filter to see all those books easily too.  Using
>> these types of set intersection operations even bypasses the
>> traditional Lucene search by simply dealing with efficiently
>> structure sets of document id's.
>>
>>      Erik
>
>
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ferret-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ferret-talk

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

Reply via email to