lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syedfa <fayyazud...@gmail.com>
Subject Re: Displaying and highlighting results from a Wild Card and Fuzzy search using Lucene in Java
Date Tue, 17 Jun 2008 04:45:07 GMT

Thanks very much for your reply.  I am having problems creating an
IndexReader object for this purpose.  This is the relevant code for my
method:


public List wildSearch(File indexDir) throws Exception {
    	
        List searchResult = new ArrayList();
        Directory fsDir=FSDirectory.getDirectory(indexDir);
        IndexSearcher is = new IndexSearcher(fsDir);
        IndexReader	ir = new IndexReader().open(fsDir);
         
        Analyzer analyser = new StandardAnalyzer();
        Query parser=new WildcardQuery(new Term("LINES", "?rr*"));
        parser=parser.rewrite(ir);
        long start=new Date().getTime();
        Hits hits=is.search(parser);
        long end=new Date().getTime();
        QueryScorer scorer = new QueryScorer(parser);
        Highlighter highlighter = new Highlighter(scorer);

The error I am getting in eclipse is, "cannot instantiate the type
IndexReader".  What am I doing wrong?  
I am able to use the Highlighter class with a boolean search, but not with
the WildCard search, nor with the Fuzzy search.  Any suggestions?

Thanks again to all that reply.
Sincerely;
Fayyaz

markrmiller wrote:
> 
> First step:
> 
> query = query.rewrite()
> 
> Then pass the query to the Highlighter.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Displaying-and-highlighting-results-from-a-Wild-Card-and-Fuzzy-search-using-Lucene-in-Java-tp17582678p17878039.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
View raw message