本文整理汇总了Java中org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState类的典型用法代码示例。如果您正苦于以下问题:Java DefaultSortedSetDocValuesReaderState类的具体用法?Java DefaultSortedSetDocValuesReaderState怎么用?Java DefaultSortedSetDocValuesReaderState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultSortedSetDocValuesReaderState类属于org.apache.lucene.facet.sortedset包,在下文中一共展示了DefaultSortedSetDocValuesReaderState类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: search
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/** User runs a query and counts facets. */
private List<FacetResult> search() throws IOException {
DirectoryReader indexReader = DirectoryReader.open(indexDir);
IndexSearcher searcher = new IndexSearcher(indexReader);
SortedSetDocValuesReaderState state = new DefaultSortedSetDocValuesReaderState(indexReader);
// Aggregatses the facet counts
FacetsCollector fc = new FacetsCollector();
// MatchAllDocsQuery is for "browsing" (counts facets
// for all non-deleted docs in the index); normally
// you'd use a "normal" query:
FacetsCollector.search(searcher, new MatchAllDocsQuery(), 10, fc);
// Retrieve results
Facets facets = new SortedSetDocValuesFacetCounts(state, fc);
List<FacetResult> results = new ArrayList<FacetResult>();
results.add(facets.getTopChildren(10, "Author"));
results.add(facets.getTopChildren(10, "Publish Year"));
indexReader.close();
return results;
}
开发者ID:skeychen,项目名称:dswork,代码行数:25,代码来源:SimpleSortedSetFacetsExample.java
示例2: drillDown
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/** User drills down on 'Publish Year/2010'. */
private FacetResult drillDown() throws IOException {
DirectoryReader indexReader = DirectoryReader.open(indexDir);
IndexSearcher searcher = new IndexSearcher(indexReader);
SortedSetDocValuesReaderState state = new DefaultSortedSetDocValuesReaderState(indexReader);
// Now user drills down on Publish Year/2010:
DrillDownQuery q = new DrillDownQuery(config);
q.add("Publish Year", "2010");
FacetsCollector fc = new FacetsCollector();
FacetsCollector.search(searcher, q, 10, fc);
// Retrieve results
Facets facets = new SortedSetDocValuesFacetCounts(state, fc);
FacetResult result = facets.getTopChildren(10, "Author");
indexReader.close();
return result;
}
开发者ID:skeychen,项目名称:dswork,代码行数:20,代码来源:SimpleSortedSetFacetsExample.java
示例3: search
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/** User runs a query and counts facets. */
private List<FacetResult> search() throws IOException {
DirectoryReader indexReader = DirectoryReader.open(indexDir);
IndexSearcher searcher = new IndexSearcher(indexReader);
SortedSetDocValuesReaderState state = new DefaultSortedSetDocValuesReaderState(indexReader);
// Aggregatses the facet counts
FacetsCollector fc = new FacetsCollector();
// MatchAllDocsQuery is for "browsing" (counts facets
// for all non-deleted docs in the index); normally
// you'd use a "normal" query:
FacetsCollector.search(searcher, new MatchAllDocsQuery(), 10, fc);
// Retrieve results
Facets facets = new SortedSetDocValuesFacetCounts(state, fc);
List<FacetResult> results = new ArrayList<>();
results.add(facets.getTopChildren(10, "Author"));
results.add(facets.getTopChildren(10, "Publish Year"));
indexReader.close();
return results;
}
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:SimpleSortedSetFacetsExample.java
示例4: drillDown
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/** User drills down on 'Publish Year/2010'. */
private FacetResult drillDown() throws IOException {
DirectoryReader indexReader = DirectoryReader.open(directory);
IndexSearcher searcher = new IndexSearcher(indexReader);
SortedSetDocValuesReaderState state = new DefaultSortedSetDocValuesReaderState(indexReader);
// Now user drills down on Publish Year/2010:
DrillDownQuery q = new DrillDownQuery(config);
q.add("Publish Year", "2010");
FacetsCollector fc = new FacetsCollector();
FacetsCollector.search(searcher, q, 10, fc);
// Retrieve results
Facets facets = new SortedSetDocValuesFacetCounts(state, fc);
FacetResult result = facets.getTopChildren(10, "Author");
indexReader.close();
return result;
}
开发者ID:lumongo,项目名称:lumongo,代码行数:20,代码来源:FacetStorageTest.java
示例5: doSearch
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
private SearchResults doSearch(SearchQuery query, DirectoryReader reader)
throws IOException, ParseException {
try {
IndexSearcher searcher = new IndexSearcher(reader);
SortedSetDocValuesReaderState state = new DefaultSortedSetDocValuesReaderState(
reader);
FacetsCollector fc = new FacetsCollector();
TopDocs docs = FacetsCollector.search(searcher, makeQuery(query),
reader.numDocs(), fc);
Facets facets = new SortedSetDocValuesFacetCounts(state, fc);
return new LuceneSearchResults(searcher, docs, query.getStart(),
query.getRows(), facets);
} finally {
reader.close();
}
}
开发者ID:KolonelKustard,项目名称:discodj,代码行数:18,代码来源:LuceneSearchProvider.java
示例6: getTotalVariationsCountFacet
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
public int getTotalVariationsCountFacet(List<? extends FeatureFile> files, Query query) throws IOException {
if (CollectionUtils.isEmpty(files)) {
return 0;
}
SimpleFSDirectory[] indexes = fileManager.getIndexesForFiles(files);
try (MultiReader reader = openMultiReader(indexes)) {
if (reader.numDocs() == 0) {
return 0;
}
FacetsCollector facetsCollector = new FacetsCollector();
IndexSearcher searcher = new IndexSearcher(reader);
searcher.search(query, facetsCollector);
Facets facets = new SortedSetDocValuesFacetCounts(new DefaultSortedSetDocValuesReaderState(reader,
FeatureIndexFields.FACET_UID.fieldName), facetsCollector);
FacetResult res = facets.getTopChildren(reader.numDocs(), FeatureIndexFields.F_UID.getFieldName());
if (res == null) {
return 0;
}
return res.childCount;
} finally {
for (SimpleFSDirectory index : indexes) {
IOUtils.closeQuietly(index);
}
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:31,代码来源:FeatureIndexDao.java
示例7: getChromosomeIdsWhereVariationsPresentFacet
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/**
* Returns a {@code List} of chromosome IDs for a project, specified by ID, where variations exist and satisfy a
* specified query
*
* @param projectId an ID of a project, which index to query
* @param query a query to filter variations
* @return a {@code List} of chromosome IDs
* @throws IOException
*/
public List<Long> getChromosomeIdsWhereVariationsPresentFacet(long projectId, Query query) throws IOException {
List<Long> chromosomeIds = new ArrayList<>();
try (
Directory index = fileManager.getIndexForProject(projectId);
IndexReader reader = DirectoryReader.open(index)
) {
if (reader.numDocs() == 0) {
return Collections.emptyList();
}
FacetsCollector facetsCollector = new FacetsCollector();
IndexSearcher searcher = new IndexSearcher(reader);
searcher.search(query, facetsCollector);
Facets facets = new SortedSetDocValuesFacetCounts(new DefaultSortedSetDocValuesReaderState(reader,
FeatureIndexFields.FACET_CHR_ID.getFieldName()), facetsCollector);
FacetResult res = facets.getTopChildren(FACET_LIMIT, FeatureIndexFields.CHR_ID.getFieldName());
if (res == null) {
return Collections.emptyList();
}
for (LabelAndValue labelAndValue : res.labelValues) {
chromosomeIds.add(Long.parseLong(labelAndValue.label));
}
}
return chromosomeIds;
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:39,代码来源:FeatureIndexDao.java
示例8: processFacetResults
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/**
* Processes the faceting results and adds them to the QueryResults builder.
*
* @param indexSearcher the IndexSearcher performing the query
* @param facetsCollector the FacetsCollector that was used for the search
* @param facetFields the fields to Facet on
* @param resultBuilder the QueryResults.Builder
* @throws IOException if an error occurs performing faceting
*/
protected void processFacetResults(final IndexSearcher indexSearcher, final FacetsCollector facetsCollector, final Set<String> facetFields,
final QueryResults.Builder<QR> resultBuilder) throws IOException {
if (facetFields == null) {
return;
}
for (String facetField : facetFields) {
final List<FacetCount> facetResultCounts = new ArrayList<>();
// TODO this will produce an exception if no documents were indexed with the field to facet on
// java.lang.IllegalArgumentException: field "foo" was not indexed with SortedSetDocValues
// at org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState.<init>(DefaultSortedSetDocValuesReaderState.java:72)
if (facetsCollector.getMatchingDocs() != null && facetsCollector.getMatchingDocs().size() > 0) {
final SortedSetDocValuesReaderState state = new DefaultSortedSetDocValuesReaderState(indexSearcher.getIndexReader(), facetField);
final Facets facets = new SortedSetDocValuesFacetCounts(state, facetsCollector);
org.apache.lucene.facet.FacetResult result = facets.getTopChildren(10, facetField);
for (int i = 0; i < result.childCount; i++) {
LabelAndValue lv = result.labelValues[i];
facetResultCounts.add(new FacetCount(lv.label, lv.value.longValue()));
}
}
resultBuilder.addFacetResult(new FacetResult(facetField, facetResultCounts));
}
}
开发者ID:bbende,项目名称:tripod,代码行数:36,代码来源:LuceneService.java
示例9: getTotalVariationsCountFacet
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
public int getTotalVariationsCountFacet(List<? extends FeatureFile> files, Query query) throws IOException {
if (CollectionUtils.isEmpty(files)) {
return 0;
}
SimpleFSDirectory[] indexes = fileManager.getIndexesForFiles(files);
long totalIndexSize = getTotalIndexSize(indexes);
if (totalIndexSize > luceneIndexMaxSizeForGrouping) {
return 0;
}
try (MultiReader reader = openMultiReader(indexes)) {
if (reader.numDocs() == 0) {
return 0;
}
FacetsCollector facetsCollector = new FacetsCollector();
IndexSearcher searcher = new IndexSearcher(reader);
searcher.search(query, facetsCollector);
Facets facets = new SortedSetDocValuesFacetCounts(new DefaultSortedSetDocValuesReaderState(reader,
FeatureIndexFields.FACET_UID.fieldName), facetsCollector);
FacetResult res = facets.getTopChildren(reader.numDocs(), FeatureIndexFields.F_UID.getFieldName());
if (res == null) {
return 0;
}
return res.childCount;
} finally {
for (SimpleFSDirectory index : indexes) {
IOUtils.closeQuietly(index);
}
}
}
开发者ID:epam,项目名称:NGB,代码行数:35,代码来源:FeatureIndexDao.java
示例10: getChromosomeIdsWhereVariationsPresentFacet
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/**
* Returns a {@code List} of chromosome IDs for a project, specified by ID, where variations exist and satisfy a
* specified query
*
* @param projectId an ID of a project, which index to query
* @param query a query to filter variations
* @return a {@code List} of chromosome IDs
* @throws IOException
*/
public List<Long> getChromosomeIdsWhereVariationsPresentFacet(long projectId, Query query) throws IOException {
List<Long> chromosomeIds = new ArrayList<>();
try (
Directory index = fileManager.getIndexForProject(projectId);
IndexReader reader = DirectoryReader.open(index)
) {
if (reader.numDocs() == 0) {
return Collections.emptyList();
}
FacetsCollector facetsCollector = new FacetsCollector();
IndexSearcher searcher = new IndexSearcher(reader);
searcher.search(query, facetsCollector);
Facets facets = new SortedSetDocValuesFacetCounts(new DefaultSortedSetDocValuesReaderState(reader,
FeatureIndexFields.FACET_CHR_ID.getFieldName()), facetsCollector);
FacetResult res = facets.getTopChildren(FACET_LIMIT, FeatureIndexFields.CHR_ID.getFieldName());
if (res == null) {
return Collections.emptyList();
}
for (LabelAndValue labelAndValue : res.labelValues) {
chromosomeIds.add(Long.parseLong(labelAndValue.label));
}
}
return chromosomeIds;
}
开发者ID:epam,项目名称:NGB,代码行数:39,代码来源:FeatureIndexDao.java
示例11: search
import org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState; //导入依赖的package包/类
/** User runs a query and counts facets. */
private List<FacetResult> search() throws IOException {
DirectoryReader indexReader = DirectoryReader.open(directory);
IndexSearcher searcher = new IndexSearcher(indexReader);
SortedSetDocValuesReaderState state = new DefaultSortedSetDocValuesReaderState(indexReader);
// Aggregates the facet counts
FacetsCollector fc = new FacetsCollector();
// MatchAllDocsQuery is for "browsing" (counts facets
// for all non-deleted docs in the index); normally
// you'd use a "normal" query:
//FacetsCollector.search(searcher, new MatchAllDocsQuery(), 10, fc);
TotalHitCountCollector collector = new TotalHitCountCollector();
searcher.search(new MatchAllDocsQuery(), MultiCollector.wrap(collector, fc));
// Retrieve results
Facets facets = new SortedSetDocValuesFacetCounts(state, fc);
List<FacetResult> results = new ArrayList<>();
results.add(facets.getTopChildren(10, "Author"));
results.add(facets.getTopChildren(10, "Publish Year"));
indexReader.close();
return results;
}
开发者ID:lumongo,项目名称:lumongo,代码行数:28,代码来源:FacetStorageTest.java
注:本文中的org.apache.lucene.facet.sortedset.DefaultSortedSetDocValuesReaderState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论