lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Sturlese <>
Subject Doubt about Fieldcache.DEFAUL.getStrings[] and Fieldcache.DEFAULT.getStringIndex
Date Fri, 04 Sep 2009 08:09:54 GMT

Hey there, I am iterating over a DocSet and for every id I neew to get the
value of a field wich is analyzed with KeyworddAnalyzer and is not sored.
I have noticed to ways of doing it using Fieldcache. Can someone pleas
explain me the pros and contras of using one or another?
Using StringIndex:
private FieldCache.StringIndex myIndex;
myIndex = FieldCache.DEFAULT.getStringIndex(searcher.getReader(),
//for every docId...
    int currentId = i.nextDoc();
    String fieldValue = myIndex.lookup[myIndex.order[currentId]];

Using getStrings:
String[] values = FieldCache.DEFAULT.getStrings(searcher.getReader(),
//for every docId...
    int currentId = i.nextDoc();
    String fieldValue = values[currentId];

Would be true to say that if the terms are repeated many times in that index
field is better to use my first option but if the terms are never repeated
it doesn't matter to use the first or the second one?
Thanks in advance

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message