use of edu.uci.ics.texera.dataflow.source.scan.ScanSourcePredicate in project textdb by TextDB.
the class DictionaryMatcherTestHelper method getScanSourceResults.
/**
* Get the results from a DictionaryMatcher with a ScanSource Operator
* (which scans the table first and then feeds the data into the dictionary matcher)
*
* @param tableName
* @param dictionary
* @param attributeNames
* @param matchingType
* @param limit
* @param offset
* @return
* @throws TexeraException
*/
public static List<Tuple> getScanSourceResults(String tableName, Dictionary dictionary, List<String> attributeNames, KeywordMatchingType matchingType, int limit, int offset) throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
String luceneAnalyzerStr = relationManager.getTableAnalyzerString(tableName);
ScanBasedSourceOperator scanSource = new ScanBasedSourceOperator(new ScanSourcePredicate(tableName));
DictionaryPredicate dictiaonryPredicate = new DictionaryPredicate(dictionary, attributeNames, luceneAnalyzerStr, matchingType, RESULTS);
DictionaryMatcher dictionaryMatcher = new DictionaryMatcher(dictiaonryPredicate);
dictionaryMatcher.setLimit(limit);
dictionaryMatcher.setOffset(offset);
dictionaryMatcher.setInputOperator(scanSource);
Tuple tuple;
List<Tuple> results = new ArrayList<>();
dictionaryMatcher.open();
while ((tuple = dictionaryMatcher.getNextTuple()) != null) {
results.add(tuple);
}
dictionaryMatcher.close();
return results;
}
Aggregations