lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Steward <alex_luc...@yahoo.com>
Subject cannot retrieve the values of a field is not stored in the index
Date Fri, 05 Jun 2009 00:18:15 GMT


Hi,

  Is there a way I can retrieve the value of a field that is not stored in the Index?


private static void indexFile(IndexWriter writer, File f)
    throws IOException {

    if (f.isHidden() || !f.exists() || !f.canRead()) {
      return;
    }

    System.out.println("Indexing " + f.getCanonicalPath());

    Document doc = new Document();

    // add contents of file
    FileReader fr = new FileReader(f);
    
    doc.add(new Field("contents", fr));

    //adding second field which contains the path of the file
    doc.add(new Field("path", f.getCanonicalPath(),
                Field.Store.NO,
                Field.Index.NOT_ANALYZED));
}

Is there a way I can access the value of the field "path" from the document hits?

Thanks,
a



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