Ingest Service now keeps track of current Keyword Lists

This commit is contained in:
Dick Fickling 2012-02-22 17:19:18 -05:00
parent 81c9b92f27
commit d3f5b054ec

View File

@ -64,6 +64,7 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
private volatile boolean commitIndex = false; //whether to commit index next time
private volatile boolean runTimer = false;
private List<Keyword> keywords; //keywords to search
private List<KeywordSearchList> keywordLists; // lists currently being searched
//private final Object lock = new Object();
private Thread timer;
private Indexer indexer;
@ -188,6 +189,7 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
reportedHits = new HashMap<String, List<FsContent>>();
keywords = new ArrayList<Keyword>();
keywordLists = new ArrayList<KeywordSearchList>();
updateKeywords();
@ -277,17 +279,32 @@ public final class KeywordSearchIngestService implements IngestServiceFsContent
}
}
/**
* Retrieve the updated keyword search lists from the XML loader
*/
private void updateKeywords() {
KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent();
keywords.clear();
keywordLists.clear();
for(KeywordSearchList list : loader.getListsL()){
if(list.getUseForIngest())
keywordLists.add(list);
keywords.addAll(list.getKeywords());
}
logger.info(keywords.size()+"");
}
List<String> getKeywordLists() {
List<String> ret = new ArrayList<String>();
if(keywordLists == null)
return ret;
for(KeywordSearchList list : keywordLists) {
ret.add(list.getName());
}
return ret;
}
//CommitTimer wakes up every interval ms
//and sets a flag for indexer to commit after indexing next file