lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Using Highlighter for highlighting Phrase query
Date Sat, 21 Mar 2009 01:52:53 GMT

(resending msg from earlier today during @apache mail outage -- i didn't 
get a copy from the list, so i'm assuming no one did)

: Date: Fri, 20 Mar 2009 15:30:27 -0700 (PDT)
: 
: http://people.apache.org/~hossman/#java-dev
: Please Use "java-user@lucene" Not "java-dev@lucene"
: 
: Your question is better suited for the java-user@lucene mailing list ...
: not the java-dev@lucene list.  java-dev is for discussing development of
: the internals of the Lucene Java library ... it is *not* the appropriate
: place to ask questions about how to use the Lucene Java library when
: developing your own applications.  Please resend your message to
: the java-user mailing list, where you are likely to get more/better
: responses since that list also has a larger number of subscribers.
: 
: 
: 
: : Date: Tue, 17 Mar 2009 07:38:08 -0700 (PDT)
: : From: mitu2009 <musicfreaque@gmail.com>
: : Reply-To: java-dev@lucene.apache.org
: : To: java-dev@lucene.apache.org
: : Subject: Using Highlighter for highlighting Phrase query
: : 
: : 
: : Am using this version of Lucene highlighter.net API. I want to get a phrase
: : highlighted only when ALL of its words are present in the search
: : results..But,am not able to do so....for example, if my input search string
: : is "Leading telecom company", then the API only highlights "telecom" in the
: : results if the result does not contain the words "leading" and "company"...
: : 
: : Here is the code i'm using:
: : 
: : SimpleHTMLFormatter htmlFormatter = new SimpleHTMLFormatter();
: : 
: :             var appData =
: : (string)AppDomain.CurrentDomain.GetData("DataDirectory");
: :             var folderpath = System.IO.Path.Combine(appData, "MyFolder");
: : 
: :             indexReader = IndexReader.Open(folderpath);
: : 
: :             Highlighter highlighter = new Highlighter(htmlFormatter, new
: : QueryScorer(finalQuery.Rewrite(indexReader)));
: : 
: : 
: :             highlighter.SetTextFragmenter(new SimpleFragmenter(800));
: : 
: :             int maxNumFragmentsRequired = 5;
: : 
: :             string highlightedText = string.Empty;
: : 
: :             TokenStream tokenStream = this._analyzer.TokenStream(fieldName,
: : new System.IO.StringReader(fieldText));
: : 
: :             highlightedText = highlighter.GetBestFragments(tokenStream,
: : fieldText, maxNumFragmentsRequired, "...");
: : 
: :             return highlightedText;
: : 
: : -- 
: : View this message in context: http://www.nabble.com/Using-Highlighter-for-highlighting-Phrase-query-tp22560334p22560334.html
: : Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
: : 
: : 
: : ---------------------------------------------------------------------
: : To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
: : For additional commands, e-mail: java-dev-help@lucene.apache.org
: : 
: 
: 
: 
: -Hoss
: 
: 



-Hoss


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


Mime
View raw message