hi there,
after using the following code so far, i recognize today, that i get less fields, if i have more than one class in the Classes Array:
Code:
ArrayList<String> retVal = new ArrayList<String>();
SearchFactory sFactory = fSession.getSearchFactory();
ArrayList<Class> classesList = new ArrayList<Class>();
....filling the arraylist....
Class[] classes = (Class[])classesList.toArray(new Class[classesList.size()]);
DirectoryProvider provider = null;
ReaderProvider readerProvider = fSession.getSearchFactory().getReaderProvider();
IndexReader indexReader = null;
try{
for(Class c : classes){
if(sFactory != null){
provider = sFactory.getDirectoryProviders(c)[0];
if(provider != null){
indexReader = readerProvider.openReader(provider);
Collection tmpFields = indexReader.getFieldNames(FieldOption.ALL);
for(Object o : tmpFields){
if(o instanceof String){
String s = (String)o;
if(!retVal.contains(s)){
retVal.add(s);
}
}
}
readerProvider.closeReader(indexReader);
} else {
myLogger.error("Error appeared");
}
} else {
myLogger.error("Searchfactory = null");
}
}
} catch(Exception e){
myLogger.error("Error", e);
}
return retval;
For example, if i had just Class A in the array i get back 150 results. If i have Classes A,B,C in the array i get back about 50. Could anybody tell me, what i'm doing wrong here?