本文整理汇总了Java中org.apache.lucene.document.FieldSelectorResult类的典型用法代码示例。如果您正苦于以下问题:Java FieldSelectorResult类的具体用法?Java FieldSelectorResult怎么用?Java FieldSelectorResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldSelectorResult类属于org.apache.lucene.document包,在下文中一共展示了FieldSelectorResult类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
@Override
public FieldSelectorResult accept(String fieldName) {
for (Term t : terms) {
if (fieldName == t.field()) {
return FieldSelectorResult.LOAD;
}
}
return FieldSelectorResult.NO_LOAD;
}
示例2: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
public FieldSelectorResult accept(String fieldName)
{
if (fieldName.equals(field))
{
return FieldSelectorResult.LOAD;
}
else
{
return FieldSelectorResult.NO_LOAD;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:ReferenceCountingReadOnlyIndexReaderFactory.java
示例3: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
@Override
public FieldSelectorResult accept(String fieldName)
{
if( FreeTextQuery.FIELD_ID.equals(fieldName) )
{
return FieldSelectorResult.LOAD_AND_BREAK;
}
else
{
return FieldSelectorResult.NO_LOAD;
}
}
示例4: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
public FieldSelectorResult accept(String fieldName) {
if (fieldName.equals("type") || fieldName.equals("fullPath")) {
return FieldSelectorResult.LOAD;
}
return FieldSelectorResult.LAZY_LOAD;
}
示例5: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
public FieldSelectorResult accept(String fieldName) {
if (fieldName.equals("fullPath")) {
return FieldSelectorResult.LOAD;
}
return FieldSelectorResult.LAZY_LOAD;
}
示例6: initResultList
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
private List<ResultDocument> initResultList(final Identity identity, final Roles roles, final Query query, final Analyzer analyzer, final Searcher searcher,
final TopDocs docs, final int firstResult, final int maxReturns, final boolean doHighlight) throws IOException {
final FieldSelector selector = new FieldSelector() {
@Override
public FieldSelectorResult accept(final String fieldName) {
return (doHighlight || !AbstractOlatDocument.CONTENT_FIELD_NAME.equals(fieldName)) ? FieldSelectorResult.LOAD : FieldSelectorResult.NO_LOAD;
}
};
maxHits = SearchServiceFactory.getService().getSearchModuleConfig().getMaxHits();
totalHits = docs.totalHits;
totalDocs = (docs.scoreDocs == null ? 0 : docs.scoreDocs.length);
final int numOfDocs = Math.min(maxHits, docs.totalHits);
final List<ResultDocument> res = new ArrayList<ResultDocument>(maxReturns + 1);
for (int i = firstResult; i < numOfDocs && res.size() < maxReturns; i++) {
final Document doc = searcher.doc(docs.scoreDocs[i].doc, selector);
final String reservedTo = doc.get(AbstractOlatDocument.RESERVED_TO);
if (StringHelper.containsNonWhitespace(reservedTo) && !"public".equals(reservedTo) && !reservedTo.contains(identity.getKey().toString())) {
continue;// admin cannot see private documents
}
final ResultDocument rDoc = createResultDocument(doc, i, query, analyzer, doHighlight, identity, roles);
if (rDoc != null) {
res.add(rDoc);
}
if (!roles.isOLATAdmin() && i % 10 == 0) {
// Do commit after certain number of documents because the transaction should not be too big
DBFactory.getInstance().intermediateCommit();
}
}
return res;
}
示例7: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
@Override
public FieldSelectorResult accept(final String field) {
if ("id".equals(field)) {
return FieldSelectorResult.LOAD_AND_BREAK;
} else {
return FieldSelectorResult.NO_LOAD;
}
}
示例8: ReaderLocal
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
ReaderLocal(IndexConfig indexConfig, IndexDirectory indexDirectory) throws IOException, SearchLibException {
super(indexConfig);
spellCheckCache = new SpellCheckCache(100);
docSetHitsCache = new DocSetHitsCache(indexConfig);
this.indexDirectory = indexDirectory;
references = new AtomicInteger(0);
acquire();
final Directory directory = indexDirectory.getDirectory();
if (directory == null)
throw new IOException("The directory is closed");
if (indexConfig.isMulti()) {
final List<String> indexList = indexConfig.getIndexList();
indexDirectories = new IndexDirectory[indexList.size()];
indexReaders = new IndexReader[indexList.size()];
int i = 0;
for (String indexName : indexList) {
IndexDirectory indexDir =
new IndexDirectory(new File(ClientCatalog.getClient(indexName).getDirectory(), "index"));
indexDirectories[i] = indexDir;
indexReaders[i++] = IndexReader.open(indexDir.getDirectory());
}
indexReader = new MultiReader(indexReaders);
} else {
indexReaders = null;
indexDirectories = null;
indexReader = IndexReader.open(directory);
}
indexSearcher = new IndexSearcher(indexReader);
final Similarity similarity = indexConfig.getNewSimilarityInstance();
if (similarity != null)
indexSearcher.setSimilarity(similarity);
// Warm
final TopDocs topDocs = indexSearcher.search(new MatchAllDocsQuery(), 10);
if (topDocs != null && topDocs.scoreDocs != null)
for (ScoreDoc scoreDoc : topDocs.scoreDocs)
indexSearcher.doc(scoreDoc.doc, (FieldSelector) fieldName -> FieldSelectorResult.LOAD);
}
示例9: AbstractRevisionFilter
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
public AbstractRevisionFilter(final IssueManager issueManager, final PermissionManager permissionManager, final User user) {
this.issueManager = issueManager;
this.permissionManager = permissionManager;
this.user = user;
issueKeysFieldSelector = new FieldSelector() {
public FieldSelectorResult accept(String s) {
return StringUtils.equals(s, CommitIndexer.FIELD_ISSUEKEY)
? FieldSelectorResult.LOAD
: FieldSelectorResult.NO_LOAD;
}
};
}
示例10: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
@Override
public FieldSelectorResult accept(final String fieldName) {
return FieldSelectorResult.LOAD;
}
示例11: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
@Override
public FieldSelectorResult accept(String fieldName) {
return fieldSet.contains(fieldName) ? FieldSelectorResult.LOAD
: FieldSelectorResult.NO_LOAD;
}
示例12: accept
import org.apache.lucene.document.FieldSelectorResult; //导入依赖的package包/类
@Override
public FieldSelectorResult accept(String fieldName) {
if (this.name.equals(fieldName))
return FieldSelectorResult.LOAD;
return FieldSelectorResult.NO_LOAD;
}