lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Günter Kukies <guenter.kuk...@heuft.com>
Subject Indexing txt-files
Date Thu, 30 Oct 2003 07:40:46 GMT
 Hello,

I  want to add a Text field to a LUCENE Document. I checked the index with LUKE, but I don't
get any results for search in the contents Field. The test.txt is a simple ASCII-File. SimpleAnalyzer
is used on both sides search and index.

Here are the relevant code snippets:


File file = new File("/documents/test.txt");

addContent(document, new FileInputStream( file ));


 private static void addContent(Document document, InputStream is) throws IOException {
        try {
            InputStreamReader input = new InputStreamReader(is);
            document.add(Field.Text("contents", input ));
         }
        catch(Exception ex) {
            ex.printStackTrace();
        }
        finally {
            if( is != null ) {
                is.close();
            }
        }
    }


Thanks for your help

Günter
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message