lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Lu" <chris...@gmail.com>
Subject Re: Highlighter that works with phrase and span queries
Date Wed, 20 Jun 2007 23:57:35 GMT
Agree.  But I think another reason why highlighting is slow could also
be the need to retrieve the document's content, quite likely it's on
the hard drive, which usually takes around 10ms for each small
document, more for larger document.

-- 
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes:
http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes


On 6/20/07, Otis Gospodnetic <otis_gospodnetic@yahoo.com> wrote:
> Hi Mark,
>
> I know one large user (meaning: high query/highlight rates) of the current Highlighter
and this user wasn't too happy with its performance.  I don't know the details, other than
it was inefficient.  So now I'm wondering if you've benchmarked your Highlighter against that/current
Highlighter to see not only which one is more accurate, but also which one is faster, and
by how much?
>
> Thanks,
> Otis
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> Simpy -- http://www.simpy.com/  -  Tag  -  Search  -  Share
>
> ----- Original Message ----
> From: Mark Miller <markrmiller@gmail.com>
> To: java-user@lucene.apache.org
> Sent: Wednesday, June 20, 2007 12:39:27 AM
> Subject: Highlighter that works with phrase and span queries
>
> I have been working on extending the Highlighter with a new Scorer that
> correctly scores phrase and span queries. The highlighter is working
> great for me, but could really use some more banging on.
>
> If you have a need or an interest in a more accurate Highlighter, please
> give it a whirl and let me know how it went. Unlike most of the other
> alternate Lucene Highlighters, this one builds off the original contrib
> Highlighter so as to retain all of its goodness.
>
> http://myhardshadow.com/qsolreleases/lucene-highlighter-2.2.jar
>
> Example Usage
>
>     IndexSearcher searcher = new IndexSearcher(ramDir);
>     Query query = QueryParser.parse("Kenne*", FIELD_NAME, analyzer);
>     query = query.rewrite(reader); //required to expand search terms
>     Hits hits = searcher.search(query);
>
>     for (int i = 0; i < hits.length(); i++)
>     {
>         String text = hits.doc(i).get(FIELD_NAME);
>         CachingTokenFilter tokenStream = new
> CachingTokenFilter(analyzer.tokenStream(
>                         FIELD_NAME, new StringReader(text)));
>         Highlighter highlighter = new Highlighter(new SpanScorer(query,
> FIELD_NAME, tokenStream));
>         tokenStream.reset();
>
>         // Get 3 best fragments and seperate with a "..."
>         String result = highlighter.getBestFragments(tokenStream, text,
> 3, "...");
>         System.out.println(result);
>     }
>
> If you make a call to any of the getBestFragments() methods more than
> once, you must call reset() on the SpanScorer between each call.
>
> Pass null as the FIELD_NAME to ignore fields.
>
> If you want to Highlight the whole document, use a NullFragmenter.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


Mime
View raw message