lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Sturlese <marc.sturl...@gmail.com>
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(),
fieldName);
//for every docId...
    int currentId = i.nextDoc();
    String fieldValue = myIndex.lookup[myIndex.order[currentId]];
//}

Using getStrings:
String[] values = FieldCache.DEFAULT.getStrings(searcher.getReader(),
fieldName);
//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: http://www.nabble.com/Doubt-about-Fieldcache.DEFAUL.getStrings---and-Fieldcache.DEFAULT.getStringIndex-tp25289618p25289618.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message