• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleFacets类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addFacet

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
private void addFacet(SolrQueryRequest req, SolrQueryResponse rsp, SolrParams params, DocListAndSet rfDocs) {
    if( rfDocs.docSet == null ) {
        rsp.add( "facet_counts", null );
    }
    else {
        FacetComponent fct = new FacetComponent();
        rsp.add( "facet_counts", fct.getFacetCounts(new SimpleFacets(req, rfDocs.docSet, params )) );
    }
}
 
开发者ID:DiceTechJobs,项目名称:RelevancyFeedback,代码行数:10,代码来源:UnsupervisedFeedbackHandler.java


示例2: process

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
/**
 * Actually run the query
 */
@Override
public void process(ResponseBuilder rb) throws IOException {

  //SolrParams params = rb.req.getParams();
  if (rb.doFacets) {
    ModifiableSolrParams params = new ModifiableSolrParams();
    SolrParams origParams = rb.req.getParams();
    Iterator<String> iter = origParams.getParameterNamesIterator();
    while (iter.hasNext()) {
      String paramName = iter.next();
      // Deduplicate the list with LinkedHashSet, but _only_ for facet params.
      if (paramName.startsWith(FacetParams.FACET) == false) {
        params.add(paramName, origParams.getParams(paramName));
        continue;
      }
      HashSet<String> deDupe = new LinkedHashSet<>(Arrays.asList(origParams.getParams(paramName)));
      params.add(paramName, deDupe.toArray(new String[deDupe.size()]));
    }

    SimpleFacets f = new SimpleFacets(rb.req, rb.getResults().docSet, params, rb);
    
    NamedList<Object> counts = f.getFacetCounts();
    String[] pivots = params.getParams(FacetParams.FACET_PIVOT);
    if (pivots != null && pivots.length > 0) {
      PivotFacetProcessor pivotProcessor 
        = new PivotFacetProcessor(rb.req, rb.getResults().docSet, params, rb);
      SimpleOrderedMap<List<NamedList<Object>>> v 
        = pivotProcessor.process(pivots);
      if (v != null) {
        counts.add(PIVOT_KEY, v);
      }
    }
    
    rb.rsp.add("facet_counts", counts);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:40,代码来源:FacetComponent.java


示例3: addFacet

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
private void addFacet(SolrQueryRequest req, SolrQueryResponse rsp, SolrParams params, DocListAndSet mltDocs) {
    if( mltDocs.docSet == null ) {
        rsp.add( "facet_counts", null );
    }
    else {
        FacetComponent fct = new FacetComponent();
        rsp.add( "facet_counts", fct.getFacetCounts(new SimpleFacets(req, mltDocs.docSet, params )) );
    }
}
 
开发者ID:DiceTechJobs,项目名称:SolrPlugins,代码行数:10,代码来源:DiceMoreLikeThisHandler.java


示例4: listGraphNodes

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
@Override
public Iterator<Node> listGraphNodes() {
    final SolrIndexSearcher.QueryResult result = new SolrIndexSearcher.QueryResult();
    try {
		request.getSearcher().search(result, GET_GRAPH_NODES_QUERY);
		final SimpleFacets facets = new SimpleFacets(
	    		request, 
	    		result.getDocSet(), 
	    		GET_GRAPH_NODES_QUERY_PARAMS);
		
		final NamedList<Integer> list = facets.getFacetTermEnumCounts(
				request.getSearcher(), 
				result.getDocSet(),
				Field.C,
				0,
				-1,
				1,
				false,
				"count"
				,null,
				null,
				false,
				null);
		final List<Node> graphs = new ArrayList<Node>();
		for (final Entry<String, Integer> entry : list) {
			if (!SolRDFGraph.UNNAMED_GRAPH_PLACEHOLDER.equals(entry.getKey())) {
				graphs.add(NTriples.asURI(entry.getKey()));
			}
		}
		
		LOGGER.debug(MessageCatalog._00112_GRAPHS_TOTAL_COUNT, graphs.size());
		
		return graphs.iterator();
	} catch (final Exception exception) {
		LOGGER.error(MessageCatalog._00113_NWS_FAILURE, exception);
		throw new SolrException(ErrorCode.SERVER_ERROR, exception);
	}	    
}
 
开发者ID:spaziocodice,项目名称:SolRDF,代码行数:39,代码来源:LocalDatasetGraph.java


示例5: process

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
/**
 * Actually run the query
 */
@Override
public void process(ResponseBuilder rb) throws IOException
{
  if (rb.doFacets) {
    SolrParams params = rb.req.getParams();
    SimpleFacets f = new SimpleFacets(rb.req,
            rb.getResults().docSet,
            params,
            rb );

    NamedList<Object> counts = f.getFacetCounts();
    String[] pivots = params.getParams( FacetParams.FACET_PIVOT );
    if( pivots != null && pivots.length > 0 ) {
      PivotFacetHelper pivotHelper = new PivotFacetHelper(rb.req,
          rb.getResults().docSet,
          params,
          rb );
      NamedList v = pivotHelper.process(pivots);
      if( v != null ) {
        counts.add( PIVOT_KEY, v );
      }
    }
    
    // TODO ???? add this directly to the response, or to the builder?
    rb.rsp.add( "facet_counts", counts );
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:31,代码来源:FacetComponent.java


示例6: newSimpleFacets

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
protected SimpleFacets newSimpleFacets(SolrQueryRequest req, DocSet docSet, SolrParams params, ResponseBuilder rb) {
  return new SimpleFacets(req, docSet, params, rb);
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:4,代码来源:FacetComponent.java


示例7: getFacetCounts

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
public static NamedList<Object> getFacetCounts(SimpleFacets simpleFacets) {
  return getFacetCounts(simpleFacets, null);
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:4,代码来源:FacetComponent.java


示例8: doFacetSearch

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
protected static NamedList doFacetSearch(DocSet docSet, SolrParams params,
                                         SolrQueryRequest req) throws IOException, SyntaxError {
  SimpleFacets f = new SimpleFacets(req, docSet, params, null);
  NamedList counts = f.getFacetFieldCounts();
  return counts;
}
 
开发者ID:tballison,项目名称:lucene-addons,代码行数:7,代码来源:SolrConcordanceBase.java


示例9: doFacets

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "deprecation" })
private NamedList<Integer> doFacets(String fieldName, DocSet docs, SolrQueryRequest req, SolrParams params) throws IOException {
       // check of we are doing range facet
       String start_range = req.getParams().get(Params.RANGE + "." + fieldName + ".start");
       String end_range = req.getParams().get(Params.RANGE + "." + fieldName + ".end");
       String gap = req.getParams().get(Params.RANGE + "." + fieldName + ".gap");
       if (start_range != null && end_range != null && gap != null) {
       	ModifiableSolrParams x = new ModifiableSolrParams(params);
       	x.set("facet", true);
       	x.set("facet.date", fieldName);
       	x.set("facet.date.start", DateMathParserFixed.toIsoFormat(DateMathParserFixed.extract(null, start_range)));
       	x.set("facet.date.end", DateMathParserFixed.toIsoFormat(DateMathParserFixed.extract(null, end_range)));
       	x.set("facet.date.gap", gap);
       	
       	try {
       		// TODO move to range query filter
       		SimpleOrderedMap<Object> ranges = new SimpleOrderedMap<Object>();
       		new SimpleFacets(req, docs, x).getFacetDateCounts(fieldName, ranges);
       		NamedList<Object> dates = (NamedList<Object>)ranges.get(fieldName);
       		
       		// remove metadata from result set
       		dates.remove("end");
       		dates.remove("start");
       		dates.remove("gap");
       		
       		NamedList<Integer> results = new NamedList<Integer>();
       		
       		DateTime start_period = DateMathParserFixed.extract(null, start_range);
       		DateTime end_period = DateMathParserFixed.extract(null, end_range);
       		
       		// build up all dates available
       		DateTime current_start_period = start_period;
       		while (current_start_period.isBefore(end_period)) {
       		    
       		    DateMathParserFixed p = new DateMathParserFixed();
       		    p.setNow(current_start_period);
       			DateTime start_date = current_start_period;
       			DateTime stop_date = p.parseMath(gap);        			
       			
       			Object match = null;
       			for (Entry<String, Object> entry : dates) {
       				DateTime dt = DateMathParserFixed.fromIsoFormat(entry.getKey());
					if (start_date.toDate().getTime() <= dt.toDate().getTime() && dt.toDate().getTime() < stop_date.toDate().getTime()) {
						match = entry.getValue();
					}
				}
       			if (match != null) {
       				results.add(fieldName + ":[" + DateMathParserFixed.toIsoFormat(start_date) + " TO " + DateMathParserFixed.toIsoFormat(stop_date) + "]", Integer.parseInt(match.toString()));
       			} else {
       				results.add(fieldName + ":[" + DateMathParserFixed.toIsoFormat(start_date) + " TO " + DateMathParserFixed.toIsoFormat(stop_date) + "]", 0);
       			}
       			current_start_period = stop_date;
       		}
       		
       		return results;
       	} catch (Exception ex) {
       		throw new RuntimeException(ex);
       	}
       } else {
       	return new SimpleFacets(req, docs, params).getTermCounts(fieldName);
       }
   }
 
开发者ID:terrancesnyder,项目名称:solr-groupby-component,代码行数:63,代码来源:GroupByComponent.java


示例10: DistribFacetExistsField

import org.apache.solr.request.SimpleFacets; //导入依赖的package包/类
private DistribFacetExistsField(ResponseBuilder rb, String facetStr) {
  super(rb, facetStr);
  SimpleFacets.checkMincountOnExists(field, minCount); 
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:5,代码来源:FacetComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ApiMetadata类代码示例发布时间:2022-05-22
下一篇:
Java ImageFormat类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap