lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Hargrave" <Hargrav...@ldschurch.org>
Subject Geting exact term positions for each document inside a collect method...
Date Thu, 19 Jun 2003 16:10:32 GMT
I've defined my own collector (I want the raw score before it is normalized between 1.0 and
0.0). For each document I need to know the the matching term positions in the document.  I've
seen the methods in IndexReader, but how can I access them inside my collect method? Are there
other methods I am missing? 
 
        
        Term a = new Term("field", "a");
        Term b = new Term("field", "b");
        Term c = new Term("field", "c");        
        
        class MyCollector extends HitCollector
        {
            public final void collect(int doc, float score)
            {
               // need to know all matching term positions for 'doc'.
              // build a bit vector marking the position of each matched term.
            }
        }
        
        BooleanQuery bq = new BooleanQuery();
        bq.add(new TermQuery(a), false, false);
        bq.add(new TermQuery(b), false, false);
        bq.add(new TermQuery(c), false, false);
        
        HitCollector col = new MyCollector();
        
       searcher.search(bq, col);        
       Hits hits = searcher.search(bq);              


------------------------------------------------------------------------------
This message may contain confidential information, and is intended only for the use of the
individual(s) to whom it is addressed.


==============================================================================

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message