lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syedfa <>
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

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*"));
        long start=new Date().getTime();
        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.

markrmiller wrote:
> First step:
> query = query.rewrite()
> Then pass the query to the Highlighter.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message