}
public TermList getTermList(CQLTermNode term, int position, int maxTerms, ScanRequestType request) {
String index=term.getIndex();
TermList termList=new TermList();
TermType tt=null;
ArrayList<String> terms;
ArrayList<TermType> tts=new ArrayList<TermType>();
if(index.equals("oai.identifier") || index.equals("identifier"))
terms=filenames;
else {
termList.addDiagnostic(SRWDiagnostic.UnsupportedIndex, index);
return termList;
}
for(String t:terms) {
if(tts.isEmpty())
tts.add(tt=new TermType(t, new NonNegativeInteger("1"), t, TermTypeWhereInList.first, null));
else if(t.equals(tt.getValue())) {
tt.setNumberOfRecords(new NonNegativeInteger(Integer.toString(tt.getNumberOfRecords().intValue()+1)));
}
else
tts.add(tt=new TermType(t, new NonNegativeInteger("1"), t, TermTypeWhereInList.inner, null));
}
if(tts.size()==1)
tt.setWhereInList(TermTypeWhereInList.only);
else
tt.setWhereInList(TermTypeWhereInList.last);
termList.setTerms(tts.toArray(new TermType[0]));
return termList;
}