use of edu.uci.ics.texera.dataflow.dictionarymatcher.DictionaryMatcherSourceOperator in project textdb by TextDB.
the class DictionaryMatcherPerformanceTest method match.
/**
* This function does match for a dictionary
*/
public static void match(ArrayList<String> queryList, KeywordMatchingType opType, String luceneAnalyzerStr, String tableName) throws Exception {
List<String> attributeNames = Arrays.asList(MedlineIndexWriter.ABSTRACT);
Dictionary dictionary = new Dictionary(queryList);
DictionarySourcePredicate dictionarySourcePredicate = new DictionarySourcePredicate(dictionary, attributeNames, luceneAnalyzerStr, opType, tableName, SchemaConstants.SPAN_LIST);
DictionaryMatcherSourceOperator dictionaryMatcher = new DictionaryMatcherSourceOperator(dictionarySourcePredicate);
long startMatchTime = System.currentTimeMillis();
dictionaryMatcher.open();
Tuple nextTuple = null;
int counter = 0;
while ((nextTuple = dictionaryMatcher.getNextTuple()) != null) {
ListField<Span> spanListField = nextTuple.getField(SchemaConstants.SPAN_LIST);
List<Span> spanList = spanListField.getValue();
counter += spanList.size();
}
dictionaryMatcher.close();
long endMatchTime = System.currentTimeMillis();
matchTime = (endMatchTime - startMatchTime) / 1000.0;
resultCount = counter;
}
Aggregations