Hi,

I build my index with the StandardAnalyzer and
two fields:
Field field= new Field("text", new
FileReader(fullPath));
field= new Field("filepath", fullPath, Store.YES,
Index.TOKENIZED);
                    

Now, I want to highlight the search result. 
First version is fine:

TokenStream stream = new
StandardAnalyzer().tokenStream("text", new
StringReader("foo bar"));

String fragment= highlighter.getBestFragment(stream,
"foo");

But 2nd version, reading text from file, fails with an
String index out of range:
TokenStream stream = new
StandardAnalyzer().tokenStream("text", new
FileReader(filePath));
                        
Why does the second version not work? The api
mentioned only the java.io.Reader class, and both used
readers are subclasses of it.

Thanks.

Best regards,
Tomas




        
                
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: 
http://mail.yahoo.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to