* If the field name is not compatible with term retrieval, the queue will be empty for that index.
*/
private List<PriorityQueue<Object[]>> retrieveTerms() throws IOException {
int size = fieldsContext.size();
Map<String,Map<String, Int>> termFreqMapPerFieldname = new HashMap<String,Map<String, Int>>( size );
final Fields vectors;
Document maybeDocument = null;
if ( documentNumber == null && size > 0 ) {
//build the document from the entity instance
//first build the list of fields we are interested in
String[] fieldNames = new String[ size ];
Iterator<FieldContext> fieldsContextIterator = fieldsContext.iterator();
for ( int index = 0 ; index < size ; index++ ) {
fieldNames[index] = fieldsContextIterator.next().getField();
}
//TODO should we keep the fieldToAnalyzerMap around to pass to the analyzer?
Map<String,String> fieldToAnalyzerMap = new HashMap<String, String>( );
//FIXME by calling documentBuilder we don't honor .comparingField("foo").ignoreFieldBridge(): probably not a problem in practice though
maybeDocument = documentBuilder.getDocument( (T) input, null, fieldToAnalyzerMap, null, new ContextualExceptionBridgeHelper(), fieldNames );
vectors = null;
}
else {
vectors = indexReader.getTermVectors( documentNumber );
}
for ( FieldContext fieldContext : fieldsContext ) {
String fieldName = fieldContext.getField();
if ( isCompatibleField( fieldName ) ) {
Map<String,Int> termFreqMap = new HashMap<String, Int>();
termFreqMapPerFieldname.put( fieldName, termFreqMap );
final Terms vector;
if ( vectors != null ) {
vector = vectors.terms( fieldName );
}
else {
vector = null;
}