当前位置: 首页>>代码示例>>Java>>正文


Java DocSet类代码示例

本文整理汇总了Java中org.apache.solr.search.DocSet的典型用法代码示例。如果您正苦于以下问题:Java DocSet类的具体用法?Java DocSet怎么用?Java DocSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DocSet类属于org.apache.solr.search包,在下文中一共展示了DocSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ParsedParams

import org.apache.solr.search.DocSet; //导入依赖的package包/类
public ParsedParams(final SolrParams localParams, // localParams on this particular facet command
                    final SolrParams params,      // local+original
                    final SolrParams required,    // required version of params
                    final String facetValue,      // the field to or query to facet on (minus local params)
                    final DocSet docs,            // the base docset for this particular facet
                    final String key,             // what name should the results be stored under
                    final List<String> tags,
                    final int threads) {
  this.localParams = localParams;
  this.params = params;
  this.required = required;
  this.facetValue = facetValue;
  this.docs = docs;
  this.key = key;
  this.tags = tags;
  this.threads = threads;
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:18,代码来源:SimpleFacets.java

示例2: getGroupedFacetQueryCount

import org.apache.solr.search.DocSet; //导入依赖的package包/类
/**
 * Returns a grouped facet count for the facet query
 *
 * @see FacetParams#FACET_QUERY
 */
public int getGroupedFacetQueryCount(Query facetQuery, DocSet docSet) throws IOException {
  // It is okay to retrieve group.field from global because it is never a local param
  String groupField = global.get(GroupParams.GROUP_FIELD);
  if (groupField == null) {
    throw new SolrException (
        SolrException.ErrorCode.BAD_REQUEST,
        "Specify the group.field as parameter or local parameter"
    );
  }

  TermAllGroupsCollector collector = new TermAllGroupsCollector(groupField);
  Filter mainQueryFilter = docSet.getTopFilter(); // This returns a filter that only matches documents matching with q param and fq params
  Query filteredFacetQuery = new BooleanQuery.Builder()
      .add(facetQuery, Occur.MUST)
      .add(mainQueryFilter, Occur.FILTER)
      .build();
  searcher.search(filteredFacetQuery, collector);
  return collector.getGroupCount();
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:25,代码来源:SimpleFacets.java

示例3: doSimpleQuery

import org.apache.solr.search.DocSet; //导入依赖的package包/类
/**
 * Executes a basic query
 */
public static DocList doSimpleQuery(String sreq,
                                    SolrQueryRequest req,
                                    int start, int limit) throws IOException {
  List<String> commands = StrUtils.splitSmart(sreq,';');

  String qs = commands.size() >= 1 ? commands.get(0) : "";
  try {
  Query query = QParser.getParser(qs, null, req).getQuery();

  // If the first non-query, non-filter command is a simple sort on an indexed field, then
  // we can use the Lucene sort ability.
  Sort sort = null;
  if (commands.size() >= 2) {
    sort = QueryParsing.parseSortSpec(commands.get(1), req).getSort();
  }

  DocList results = req.getSearcher().getDocList(query,(DocSet)null, sort, start, limit);
  return results;
  } catch (SyntaxError e) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Error parsing query: " + qs);
  }

}
 
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:SolrPluginUtils.java

示例4: getTermCounts

import org.apache.solr.search.DocSet; //导入依赖的package包/类
private NamedList<Integer> getTermCounts(String field, String fieldPath, Integer mincount, int limit, DocSet docs) throws IOException {
    if(cachedFieldCounts.containsKey(fieldPath)){
        return cachedFieldCounts.get(fieldPath);
    }

    int offset = 0;
    if (limit == 0) return new NamedList<Integer>();

    String sort = FacetParams.FACET_SORT_COUNT;
    NamedList<Integer> counts;

    FacetMethod method = getFacetMethod(field);
    switch (method) {
        case ENUM:
            // intersectsCheck should be false, else facet counts will be capped at 1 (binary)
            counts = getFacetTermEnumCounts(searcher, docs, field, offset, limit, mincount,false,sort,null, null, false, false);
            break;
        case FC:
            counts = DocValuesFacets.getCounts(searcher, docs, field, offset, limit, mincount, false, sort, null, null, false, null);
            break;
        default:
            throw new AssertionError();
    }
    cachedFieldCounts.put(fieldPath, counts);
    return counts;
}
 
开发者ID:DiceTechJobs,项目名称:SolrPlugins,代码行数:27,代码来源:JointCounts.java

示例5: printDocIDs

import org.apache.solr.search.DocSet; //导入依赖的package包/类
@SuppressWarnings("unused")
private void printDocIDs(DocSet fromSet) throws IOException {
	// Only used in debugging.
	System.out.println("---------------------------");
	DocIterator iter = fromSet.iterator();
	while (iter.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
		Integer docId = iter.next();
		Document d = fromSearcher.doc(docId);
		String id = d.getValues("id")[0];
		// TODO :log message  (this is too verbose?)
		if (debug) {
			System.out.println("INTERNAL ID : " + docId + " DOC : " + id);
		}
	}
	System.out.println("---------------------------");
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:17,代码来源:GraphQuery.java

示例6: create

import org.apache.solr.search.DocSet; //导入依赖的package包/类
/**
 * Factory method used to create {@link SolrCachingPathScorer} instances.
 * @param acceptDocs 
 */
public static SolrCachingPathScorer create(SolrCachingPathWeight weight,
                                           AtomicReaderContext context,
                                           Bits acceptDocs, SolrIndexSearcher searcher,
                                           SolrPathQuery wrappedPathQuery) throws IOException
{
    DocSet results = (DocSet) searcher.cacheLookup(CacheConstants.ALFRESCO_PATH_CACHE, wrappedPathQuery);
    if (results == null)
    {
        // Cache miss: get path query results and cache them
        WrappedQuery wrapped = new WrappedQuery(wrappedPathQuery);
        wrapped.setCache(false);
        results = searcher.getDocSet(wrapped);
        searcher.cacheInsert(CacheConstants.ALFRESCO_PATH_CACHE, wrappedPathQuery, results);
    }
    
    return new SolrCachingPathScorer(weight, results, context, acceptDocs, searcher);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:SolrCachingPathScorer.java

示例7: AbstractSolrCachingScorer

import org.apache.solr.search.DocSet; //导入依赖的package包/类
AbstractSolrCachingScorer(Weight weight, DocSet in, AtomicReaderContext context, Bits acceptDocs, SolrIndexSearcher searcher)
{
    super(weight);
    this.context = context;
    this.acceptDocs = acceptDocs;
    
    if (in instanceof BitDocSet)
    {
        matches = (BitDocSet) in;
    }
    else
    {
        this.matches = new BitDocSet(new FixedBitSet(searcher.maxDoc()));
        for (DocIterator it = in.iterator(); it.hasNext(); /* */)
        {
            matches.addUnique(it.nextDoc());
        }
    }
    bitSet = matches.getBits();
    
    doc = getBase() - 1;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:AbstractSolrCachingScorer.java

示例8: createOwnerScorer

import org.apache.solr.search.DocSet; //导入依赖的package包/类
public static SolrOwnerScorer createOwnerScorer(Weight weight, AtomicReaderContext context, Bits acceptDocs, SolrIndexSearcher searcher, String authority) throws IOException
{
    if (AuthorityType.getAuthorityType(authority) == AuthorityType.USER)
    {
        DocSet ownedDocs = (DocSet) searcher.cacheLookup(CacheConstants.ALFRESCO_OWNERLOOKUP_CACHE, authority);

        if (ownedDocs == null)
        {
            // Cache miss: query the index for docs where the owner matches the authority. 
            ownedDocs = searcher.getDocSet(new TermQuery(new Term(QueryConstants.FIELD_OWNER, authority)));
            searcher.cacheInsert(CacheConstants.ALFRESCO_OWNERLOOKUP_CACHE, authority, ownedDocs);
        }
        return new SolrOwnerScorer(weight, ownedDocs, context, acceptDocs, searcher);
    }
    
    // Return an empty doc set, as the authority isn't a user.
    return new SolrOwnerScorer(weight, new BitDocSet(new FixedBitSet(0)), context, acceptDocs, searcher);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:SolrOwnerScorer.java

示例9: updateDescendantAuxDocs

import org.apache.solr.search.DocSet; //导入依赖的package包/类
private void updateDescendantAuxDocs(NodeMetaData parentNodeMetaData, boolean overwrite,
            SolrIndexSearcher solrIndexSearcher, LinkedHashSet<Long> stack, DocSet skippingDocs) throws AuthenticationException,
            IOException, JSONException
{
    if (stack.contains(parentNodeMetaData.getId()))
    {
        log.warn("Found aux data loop for node id " + parentNodeMetaData.getId());
        log.warn("... stack to node =" + stack);
        return;
    }
    else
    {
        try
        {
            stack.add(parentNodeMetaData.getId());
            doUpdateDescendantAuxDocs(parentNodeMetaData, overwrite, solrIndexSearcher, stack, skippingDocs);
        }
        finally
        {
            stack.remove(parentNodeMetaData.getId());
        }

    }

}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:26,代码来源:LegacySolrInformationServer.java

示例10: getDocSetSize

import org.apache.solr.search.DocSet; //导入依赖的package包/类
@Override
public int getDocSetSize(String targetTxId, String targetTxCommitTime) throws IOException
{
    RefCounted<SolrIndexSearcher> refCounted = null;
    try
    {
        refCounted = core.getSearcher(false, true, null);
        SolrIndexSearcher solrIndexSearcher = refCounted.get();
        BooleanQuery query = new BooleanQuery();
        query.add(new TermQuery(new Term(QueryConstants.FIELD_TXID, targetTxId)), Occur.MUST);
        query.add(new TermQuery(new Term(QueryConstants.FIELD_TXCOMMITTIME, targetTxCommitTime)), Occur.MUST);
        DocSet set = solrIndexSearcher.getDocSet(query);

        return set.size();
    }
    finally
    {
        if (refCounted != null)
        {
            refCounted.decref();
        }
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:LegacySolrInformationServer.java

示例11: Aggregate

import org.apache.solr.search.DocSet; //导入依赖的package包/类
public Aggregate(SolrQueryRequest req, DocSet base, String fieldName) {
    this.base = base;
    this.fieldName = fieldName;
    this.req = req;

    String percentiles = req.getParams().get(GroupByComponent.Params.PERCENTILES, "");
    if (percentiles != null && percentiles.isEmpty() == false) {
        this.doPercentiles = true;
        List<Integer> list = new ArrayList<Integer>();
        for (String p : percentiles.split(",")) {
            list.add(Integer.parseInt(p));
        }
        this.requestedPercentiles = list.toArray(new Integer[] {});
        this.compression = req.getParams().getDouble(GroupByComponent.Params.PERCENTILES_COMPRESSION, 100);
    }
}
 
开发者ID:terrancesnyder,项目名称:solr-groupby-component,代码行数:17,代码来源:Aggregate.java

示例12: testMultiValued

import org.apache.solr.search.DocSet; //导入依赖的package包/类
@Test
public void testMultiValued() throws Exception {
  Query q = parse(COMPONENT_NAME_4);
  DocSet docs = searcher.getDocSet(q);

  assertEquals(4, docs.size());
  DocIterator it = docs.iterator();
  assertTrue(it.hasNext());
  assertEquals(0, it.nextDoc());
  assertTrue(it.hasNext());
  assertEquals(1, it.nextDoc());
  assertTrue(it.hasNext());
  assertEquals(2, it.nextDoc());
  assertTrue(it.hasNext());
  assertEquals(3, it.nextDoc());
  assertFalse(it.hasNext());    
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:18,代码来源:TestXJoinQParserPlugin.java

示例13: findParentIdsForNodes

import org.apache.solr.search.DocSet; //导入依赖的package包/类
private Map<String, Set<String>> findParentIdsForNodes(SolrIndexSearcher searcher, Collection<String> nodeIds) throws IOException {
	Map<String, Set<String>> parentIds = new HashMap<>();
	
	LOGGER.debug("Looking up parents for {} nodes", nodeIds.size());
	Query filter = buildFilterQuery(getNodeField(), nodeIds);
	LOGGER.trace("Filter query: {}", filter);
	
	DocSet docs = searcher.getDocSet(filter);
	
	for (DocIterator it = docs.iterator(); it.hasNext(); ) {
		Document doc = searcher.doc(it.nextDoc(), docFields);
		String nodeId = doc.get(getNodeField());
		
		Set<String> parentIdValues = new HashSet<>(Arrays.asList(doc.getValues(parentField)));
		parentIds.put(nodeId, parentIdValues);
		
		// Record the label, if required
		if (isLabelRequired(nodeId)) {
			recordLabel(nodeId, doc.getValues(getLabelField()));
		}
	}
	
	return parentIds;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:25,代码来源:ParentNodeFacetTreeBuilder.java

示例14: SimpleFacets

import org.apache.solr.search.DocSet; //导入依赖的package包/类
public SimpleFacets(SolrQueryRequest req,
                    DocSet docs,
                    SolrParams params,
                    ResponseBuilder rb) {
  this.req = req;
  this.searcher = req.getSearcher();
  this.docsOrig = docs;
  this.global = params;
  this.rb = rb;
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:11,代码来源:SimpleFacets.java

示例15: getFieldMissingCount

import org.apache.solr.search.DocSet; //导入依赖的package包/类
/**
 * Returns a count of the documents in the set which do not have any 
 * terms for for the specified field.
 *
 * @see FacetParams#FACET_MISSING
 */
public static int getFieldMissingCount(SolrIndexSearcher searcher, DocSet docs, String fieldName)
  throws IOException {
  SchemaField sf = searcher.getSchema().getField(fieldName);
  DocSet hasVal = searcher.getDocSet
      (sf.getType().getRangeQuery(null, sf, null, null, false, false));
  return docs.andNotSize(hasVal);
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:14,代码来源:SimpleFacets.java


注:本文中的org.apache.solr.search.DocSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。