Hi,
I have saved payload in my index. When the user types the query I get HIT
document. From HIT document how I can get the value of Payload for particular
tree.
For example
_analyzer = new PayloadAnalyzer();
_writer = new IndexWriter(new File("d:/test1"), _analyzer, true);
for (int i = 0; i < 10; i++) {
Document d = new Document();
d.add(new Field("f1", "This field has no payloads",
Field.Store.NO, Field.Index.TOKENIZED));
d.add(new Field("f2", "This field has payloads in all docs",
Field.Store.YES, Field.Index.TOKENIZED));
Integer i1 = i;
byte []payLoadData = null;
payLoadData[0] = i1.byteValue();
_analyzer.setPayloadData("f2", payLoadData);
_writer.addDocument(d);
}
writer.optimize();
// flush
writer.close();
String queryString = "payloads + doc";
System.out.println("Reading Payload Data will begin now");
_parser = new QueryParser("f2", new PayloadAnalyzer());
_searcher = new IndexSearcher("d:/test1");
Query query =_parser.parse(queryString);
Hits hits = _searcher.search(query);
for (int i = 0; i < hits.length(); i++) {
Document doc = hits.doc(i);
Here I want to get the value of payload for the field..
Please let me know how I can get value of payload for a field from Hits
}
Thanks in Advance
Warm Regards,
Allahbaksh
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not to copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is not
liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***