lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: Displaying and highlighting results from a Wild Card and Fuzzy search using Lucene in Java
Date Tue, 17 Jun 2008 11:37:20 GMT
I am not seeing the problem. One small thing is that you don't need to 
make another Reader...you can get the one from the IndexSearcher. But I 
dont see why your are getting that error...that is the type of error you 
would get if you were trying to use IndexReaders Protected constructor 
outside the index package...but you are correctly using the static open 
call...
> 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?
>
>
>   


---------------------------------------------------------------------
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