Hi
I am trying to speed up access to the data in my results Documents and
was wondering if FieldSelector might be the way forward? After my
search, I end up with an ArrayList of Documents, from each of which I
need to extract certain fields and their values as key/value pairs in a
HashMap. Normally this is quick, but with large data sets (10,000+) it
can take several seconds. Here is the essence of the current code:
for (Document doc : resultDocs) {
keyVals = getDocKeyValuePairs(doc, fields);
if (keyVals != null) {
resultsList.add(keyVals);
}
}
private HashMap getDocKeyValuePairs(Document doc, List<String>
fields) {
HashMap keyValMap = new HashMap();
String field;
String value;
for(int i = 0; i < fields.size(); i++) {
field = fields.get(i);
value = doc.get(field);
if (value != null) {
keyValMap.put(field, value);
}
}
return keyValMap;
}
I am aware that this code may not be efficient, so any suggestions
welcomed. Also, how would one apply a FieldSelector in this case?
Thanks
- Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org