热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.solr.client.solrj.response.QueryResponse.getFacetFields()方法的使用及代码示例

本文整理了Java中org.apache.solr.client.solrj.response.QueryResponse.getFacetFields方法的一些代码示

本文整理了Java中org.apache.solr.client.solrj.response.QueryResponse.getFacetFields方法的一些代码示例,展示了QueryResponse.getFacetFields的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryResponse.getFacetFields方法的具体详情如下:
包路径:org.apache.solr.client.solrj.response.QueryResponse
类名称:QueryResponse
方法名:getFacetFields

QueryResponse.getFacetFields介绍

[英]See also: #getLimitingFacets()
[中]另请参见:#getLimitingFacets()

代码示例

代码示例来源:origin: apache/nifi

for (final FacetField facetField : response.getFacetFields()){
writer.name(facetField.getName());
writer.beginArray();

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public void setFacetResults(Map namedFacetMap, QueryResponse response) {
if (response.getFacetFields() != null) {
for (FacetField facet : response.getFacetFields()) {
String facetFieldName = facet.getName();
SearchFacetDTO facetDTO = namedFacetMap.get(facetFieldName);

代码示例来源:origin: org.opencms/opencms-core

/**
* Delegator.


*
* @return the list of faceted fields
*/
public List getFacetFields() {
return m_queryResponse.getFacetFields();
}

代码示例来源:origin: org.intermine/intermine-api

for (KeywordSearchFacetData facet : facetVector) {
List facetFields = resp.getFacetFields();

代码示例来源:origin: intermine/intermine

for (KeywordSearchFacetData facet : facetVector) {
List facetFields = resp.getFacetFields();

代码示例来源:origin: keeps/roda

private static IndexResult queryResponseToIndexResult(QueryResponse response,
Class responseClass, Facets facets, List liteFields) throws GenericException, NotSupportedException {
final SolrDocumentList docList = response.getResults();
final List facetResults = processFacetFields(facets, response.getFacetFields());
final long offset = docList.getStart();
final long limit = docList.size();
final long totalCount = docList.getNumFound();
final List docs = new ArrayList<>();
for (SolrDocument doc : docList) {
docs.add(SolrCollectionRegistry.fromSolrDocument(responseClass, doc, liteFields));
}
return new IndexResult<>(offset, limit, totalCount, docs, facetResults);
}

代码示例来源:origin: spring-projects/spring-data-solr

static Map> convertFacetQueryResponseToFacetPageMap(FacetQuery query,
QueryResponse response) {
Assert.notNull(query, "Cannot convert response for 'null', query");
if (!hasFacets(query, response)) {
return Collections.emptyMap();
}
Map> facetResult = new LinkedHashMap<>();
if (!CollectionUtils.isEmpty(response.getFacetFields())) {
int initalPageSize = Math.max(1, query.getFacetOptions().getPageable().getPageSize());
for (FacetField facetField : response.getFacetFields()) {
if (facetField != null && StringUtils.hasText(facetField.getName())) {
Field field = new SimpleField(facetField.getName());
if (!CollectionUtils.isEmpty(facetField.getValues())) {
List pageEntries = new ArrayList<>(initalPageSize);
for (Count count : facetField.getValues()) {
if (count != null) {
pageEntries.add(new SimpleFacetFieldEntry(field, count.getName(), count.getCount()));
}
}
facetResult.put(field, new SolrResultPage<>(pageEntries, query.getFacetOptions().getPageable(),
facetField.getValueCount(), null));
} else {
facetResult.put(field, new SolrResultPage<>(Collections. emptyList(),
query.getFacetOptions().getPageable(), 0, null));
}
}
}
}
return facetResult;
}

代码示例来源:origin: headwirecom/aem-solr-search

private void cleanQueryAndResponseFacets() {
String[] filterQueries = solrQuery.getFilterQueries();
// if (filterQueries != null) {
// for (int i=0; i// filterQueries[i] = cleanFilterQuery(filterQueries[i]);
// solrQuery.setFilterQueries(filterQueries);
// }

for (FacetField field : queryResponse.getFacetFields())
for (FacetField.Count fieldCount : field.getValues())
fieldCount.setName(cleanFilterQuery(fieldCount.getName()));
}

代码示例来源:origin: org.geotools/gt-solr

@Override
public List createTypeNames(HttpSolrClient solrServer) throws Exception {
List names = new ArrayList<>();
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
query.addFacetField(field);
query.setFacet(true);
query.setFacetMinCount(1);
query.setFacetSort(FacetParams.FACET_SORT_INDEX);
query.setRows(0);
query.setParam("omitHeader", true);
QueryResponse rsp = solrServer.query(query);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "SOLR query done: " + query.toString());
}
List uniqueFacetFields = rsp.getFacetFields().get(0).getValues();
for (Count field : uniqueFacetFields) {
names.add(field.getName());
}
return names;
}

代码示例来源:origin: DSpace/DSpace

for (FacetField ff : sr.getFacetFields()) {
String s = ff.getName().equals("type") ? "View" : "Search";
for (FacetField.Count count : ff.getValues()) {

代码示例来源:origin: tflobbe/solrmeter

@SuppressWarnings("unchecked")
public QueryLogValue(QueryResponse response) {
Object parameter;
error = false;
NamedList params = (NamedList)response.getResponseHeader().get("params");
if(params!=null) {
parameter = params.get("q");
if (parameter != null) {
queryString = parameter.toString();
}
parameter = params.get("fq");
if (parameter != null) {
filterQueryString = parameter.toString();
}
}

facetQueryString = createFacetQuery(response.getFacetFields());
qTime = response.getQTime();
results = response.getResults().getNumFound();
}

代码示例来源:origin: vivo-project/Vitro

static SearchResponse convertToSearchResponse(QueryResponse response) {
return new BaseSearchResponse(response.getHighlighting(),
convertToSearchFacetFieldMap(response.getFacetFields()),
new SolrSearchResultDocumentList(response.getResults()));
}

代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl

final List fieldFacets = queryResponse.getFacetFields();
if (CollectionUtils.isNotEmpty(fieldFacets)) {
for (final FacetField facetField : fieldFacets) {

代码示例来源:origin: stackoverflow.com

public static void main()
{
String url = "http://localhost:8983/solr/autocomplete";
SolrServer solrServer = new HttpSolrServer(url);
SolrQuery query = new SolrQuery();
query.set("q", "*");
query.addFilterQuery("name:*");
query.setFacet(true);
query.addFacetField("name");
System.out.println(query);
QueryResponse queryRespOnse= solrServer.query(query);
List facetFields = queryResponse.getFacetFields();
FacetField cnameMainFacetField = queryResponse.getFacetField("name");
for (Count cnameAndCount : cnameMainFacetField.getValues()) {
String cnameMain = cnameAndCount.getName();
System.out.println(cnameMain);
System.out.println(cnameAndCount.getCount());
}

代码示例来源:origin: tflobbe/solrmeter

public void showResults(QueryResponse response) {
jScrollPaneError.setVisible(false);
outputPanel.setVisible(true);
jLabelQueryTime.setText(I18n.get("queryPanel.queryTime") + " " + response.getQTime() + " ms");
jLabelResultsFound.setText(I18n.get("queryPanel.resultsFound") + " " + response.getResults().getNumFound());
this.setFacets(response.getFacetFields());
resultsTableModel.setResponse(response);
jTableResults.setModel(resultsTableModel);
jTableResults.doLayout();
jTableResults.requestFocusInWindow();
resultsTableModel.fireTableStructureChanged();
resultsTableModel.fireTableDataChanged();
this.revalidate();
}

代码示例来源:origin: perfectsense/dari

for (FacetField facetField : response.getFacetFields()) {
List values = facetField.getValues();
if (values == null) {

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

List facetFields = queryResponse.getFacetFields();
if (facetFields == null || facetFields.isEmpty()){
endOfFacetResults = true;

代码示例来源:origin: se.vgregion.innovationsslussen/innovationsslussen-core-bc-composite-svc

limitingFacets = queryResponse.getFacetFields();

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

List facetFields = queryResponse.getFacetFields();

代码示例来源:origin: sirensolutions/siren

QueryResponse r = getWrapper().getServer().query(q);
assertEquals(1, r.getFacetFields().get(0).getValues().get(0).getCount());
assertEquals(1, r.getFacetFields().get(0).getValues().get(0).getCount());
assertEquals(1, r.getFacetFields().get(0).getValues().get(1).getCount());

推荐阅读
author-avatar
fspygh
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有