use of org.apache.cxf.jaxrs.ext.search.lucene.LuceneQueryVisitor in project cxf by apache.
the class TikaLuceneContentExtractorTest method getHits.
private ScoreDoc[] getHits(final String expression, final Map<String, Class<?>> fieldTypes) throws IOException {
IndexReader reader = DirectoryReader.open(directory);
IndexSearcher searcher = new IndexSearcher(reader);
try {
LuceneQueryVisitor<SearchBean> visitor = new LuceneQueryVisitor<SearchBean>("ct", "contents");
visitor.setPrimitiveFieldTypeMap(fieldTypes);
visitor.visit(parser.parse(expression));
ScoreDoc[] hits = searcher.search(visitor.getQuery(), null, 1000).scoreDocs;
assertNotNull(hits);
return hits;
} finally {
reader.close();
}
}
Aggregations