1

Hello i have 3 fields title,content,url and i created the index added some document

 Document doc = new Document();
  doc.add(new TextField("title", title, Field.Store.YES));
  doc.add(new TextField("content", title, Field.Store.YES));
  doc.add(new StringField("url", isbn, Field.Store.NO));
  w.addDocument(doc);

I can read the index using the index writer and iterate and receive the field title,content how can i receive the field url ?

Kathick
  • 1,395
  • 5
  • 19
  • 30

3 Answers3

1

You can search using "url" field but cannot get(display) it

for Example:

Field.Store.NO is suitable for id like fields which you need only to retrieve documents not for displaying

rrsk
  • 124
  • 4
  • 13
0

Since you chose not to store it, I don't think you can. That's exactly what the "store" option is for (allowing you to retrieve more data than just the document id).

Thilo
  • 257,207
  • 101
  • 511
  • 656
0

how can i receive the field url?

You can't. Field.Store.NO means Lucene takes this value and only uses it for indexing purposes so this document can be found if you query by matching url.

mindas
  • 26,463
  • 15
  • 97
  • 154