lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karthik N S" <kart...@controlnet.co.in>
Subject org.apache.lucene.search.highlight.Highlighter
Date Wed, 19 May 2004 08:17:12 GMT



Hey Guys
Found some Highlighter Package on CVS Directory
Was Investigating,found some Compile time error..

Please some body tell me what this



The Code:-

private IndexReader reader=null;
private Highlighter highlighter = null;

 public SearchFiles() {
 }

 public void searchIndex0(String srchkey,String pathfile)throws Exception {
  IndexSearcher searcher = new IndexSearcher(pathfile);
  Query query = QueryParser.parse(srchkey,"bookid", analyzer);
  query=query.rewrite(reader); //required to expand search terms
  Hits hits = searcher.search(query);

   highlighter = new Highlighter(this,new QueryScorer(query));
  for (int i = 0; i < hits.length(); i++) {
   String text = hits.doc(i).get(bookid);
   TokenStream tokenStream=analyzer.tokenStream(bookid,new
StringReader(text));
   // Get 3 best fragments and seperate with a "..."
   String result = highlighter.getBestFragments(tokenStream,text,3,"...");
   System.out.println(result);
  }
 }



The Error:-
src\org\apache\lucene\search\higlight\SearchFiles.java:46: cannot resolve
symbol
symbol : constructor Highlighter
(com.controlnet.higlight.SearchFiles,com.controlnet.higlight.QueryScorer)
location: class org.apache.lucene.search.highlight.Highlighter highlighter
=new Highlighter(this,new QueryScorer(query));

Also Reffrells  to  URL from archives lucene-dev is not avaliable for proper
documentation
http://home.clara.net/markharwood/lucene/highlight.htm





















      WITH WARM REGARDS
      HAVE A NICE DAY
      [ N.S.KARTHIK]



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