// We purge the query terms not present in the lexicon and retrieve the information from the lexicon
String[] queryTermStrings = queryTerms.getTerms();
queryTermsToMatchList = new ArrayList<Map.Entry<String,LexiconEntry>>(queryTermStrings.length);
for (String queryTerm: queryTermStrings) {
LexiconEntry t = lexicon.getLexiconEntry(queryTerm);
if (t != null) {
//check if the term IDF is very low.
if (IGNORE_LOW_IDF_TERMS && collectionStatistics.getNumberOfDocuments() < t.getFrequency()) {
//logger.warn("query term " + queryTerm + " has low idf - ignored from scoring.");
continue;
}
// check if the term has weighting models
WeightingModel[] termWeightingModels = queryTerms.getTermWeightingModels(queryTerm);
if (termWeightingModels.length == 0) {
//logger.warn("No weighting models for term " + queryTerm +", skipping scoring");
continue;
}
queryTermsToMatchList.add(new MapEntry<String, LexiconEntry>(queryTerm, t));
}
else
logger.debug("Term Not Found: " + queryTerm);
}
////logger.warn("queryTermsToMatchList = " + queryTermsToMatchList.size());
int queryLength = queryTermsToMatchList.size();
wm = new WeightingModel[queryLength][];
for (int i = 0; i < queryLength; i++)
{
Map.Entry<String, LexiconEntry> termEntry = queryTermsToMatchList.get(i);
String queryTerm = termEntry.getKey();
LexiconEntry lexiconEntry = termEntry.getValue();
//get the entry statistics - perhaps this came from "far away"
EntryStatistics entryStats = queryTerms.getStatistics(queryTerm);
//if none were provided with the query we seek the entry statistics query term in the lexicon
if (entryStats == null)
{