只检索网页内容的Indexer:
Liferary大牛 冷月 指点的,在这里表示一下感谢。
Indexer indexer = IndexerRegistryUtil.getIndexer(JournalArticle.class);
用categoryID来进行检索,不用setKeywords的方法:
Indexer indexer = IndexerRegistryUtil.getIndexer(JournalArticle.class);
BooleanQuery fullQuery = BooleanQueryFactoryUtil.create(searchContext);
for (long assetCategoryId : searchContext.getCategoryIds()) {
fullQuery.addTerm("assetCategoryIds", assetCategoryId);
}
BooleanClause booleanClause = BooleanClauseFactoryUtil.create(searchContext, fullQuery, BooleanClauseOccur.MUST.getName());
searchContext.setBooleanClauses(new BooleanClause[] { booleanClause } );
Hits hits = indexer.search(searchContext);