lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy" <digyd...@gmail.com>
Subject RE: FastVectorHighlighter truncated queries
Date Thu, 04 Mar 2010 21:47:22 GMT
I don't think that it is related with lucene version.

Please inspect the C# code below. "fragments1" has no highlight info, on the
other hand "fragments2" has one.

 

                

            RAMDirectory dir = new RAMDirectory();

            IndexWriter wr = new IndexWriter(dir, new WhitespaceAnalyzer(),
true);

            Document doc = new Document();

            doc.Add(new Field("f1", "aaa aab aac aad", Field.Store.YES,
Field.Index.ANALYZED,Field.TermVector.WITH_POSITIONS_OFFSETS));

            wr.AddDocument(doc);

            wr.Close();

 

            IndexReader rdr = IndexReader.Open(dir, true);

 

            QueryParser p = new QueryParser("f1", new WhitespaceAnalyzer());

            Query q = p.Parse("aa*");

                      

            Lucene.Net.Search.Vectorhighlight.FastVectorHighlighter fvh =
new Lucene.Net.Search.Vectorhighlight.FastVectorHighlighter();

 

            string[] fragments1 =
fvh.GetBestFragments(fvh.GetFieldQuery(q.Rewrite(rdr)), rdr, 0, "f1", 100,
2);

            

            if (q is MultiTermQuery)

            {

 
((MultiTermQuery)q).SetRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_RE
WRITE);

            }

            string[] fragments2 =
fvh.GetBestFragments(fvh.GetFieldQuery(q.Rewrite(rdr)), rdr, 0, "f1", 100,
2);

 

 

DIGY

 

 

-----Original Message-----
From: halbtuerderschwarze [mailto:halbtuerderschwarze@web.de] 
Sent: Thursday, March 04, 2010 11:22 PM
To: java-user@lucene.apache.org
Subject: RE: FastVectorHighlighter truncated queries

 

 

Not with Lucene 3.0.1.

Tomorrow I will try it with 2.9.2.

Arne

-- 

View this message in context:
http://old.nabble.com/FastVectorHighlighter-truncated-queries-tp27709797p277
86722.html

Sent from the Lucene - Java Users mailing list archive at Nabble.com.

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org

For additional commands, e-mail: java-user-help@lucene.apache.org


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