List of usage examples for org.apache.solr.client.solrj SolrQuery setFacetMinCount
public SolrQuery setFacetMinCount(int cnt)
From source file:org.craftercms.commerce.server.solr.AbstractSolrCRUDService.java
License:Open Source License
public ServiceResponse<T> findByQuery(String query, int offset, int maxResults, String... facet) throws CrafterCommerceException { try {/*from w w w. j a va 2 s.co m*/ String solrQueryStr = queryConverter.toSolrQuery(query); SolrQuery solrQuery = new SolrQuery(solrQueryStr); solrQuery.setStart(offset); solrQuery.setRows(maxResults); // construct facet parameters if (facet.length > 0) { solrQuery.setFacet(true); solrQuery.setFacetMinCount(2); // only get the facet if there are 2 or more values for (String _facet : facet) { solrQuery.addFacetField(_facet); } } // execute Solr query QueryResponse response = solrServer.query(solrQuery); Set<T> entities = toEntities(response); Set<Facet> facets = toFacets(response); // create the service response ServiceResponse<T> serviceResponse = new ServiceResponse<T>(); serviceResponse.setSuccess(true); serviceResponse.setEntities(entities); serviceResponse.setCount(response.getResults().getNumFound()); serviceResponse.setFacets(facets); String msg = ReturnMessageProvider.findByQueryMessage(getTypeArgument(), query, entities.size()); serviceResponse.setMessage(msg); // return the response return serviceResponse; } catch (Exception e) { LOGGER.error("Failed to find entities by query for query = " + query, e); return new ServiceResponse<T>(getTypeArgument(), false, e.getMessage()); } }
From source file:org.dspace.app.cris.network.AVisualizationGraph.java
@Override public JsGraph search(String authority, String name, Integer level, boolean showExternal, boolean showSameDept, String dept, Integer modeEntity) throws Exception { SolrQuery solrQuery = new SolrQuery(); String query = buildQuery(authority, name, showSameDept, dept, modeEntity, level); String[] fqs = { "type:" + getConnectionName(), "entity:" + modeEntity }; solrQuery.setQuery(query);// w w w.j a v a 2 s . c o m solrQuery.addFilterQuery(fqs); if (!showExternal && authority != null && !authority.isEmpty()) { solrQuery.addFilterQuery(new String[] { "a_auth:rp*", "b_auth:rp*" }); } solrQuery.setFacet(true); solrQuery.addFacetField(FACET_SEARCH); if (modeEntity == ConstantNetwork.ENTITY_RP) { solrQuery.setFacetLimit(getLimitLevel(level)); } else if (modeEntity == ConstantNetwork.ENTITY_DEPT) { solrQuery.setFacetLimit(Integer.MAX_VALUE); } solrQuery.setFacetMinCount(1); solrQuery.setRows(0); QueryResponse rsp = service.search(solrQuery); FacetField facets = rsp.getFacetField(FACET_SEARCH); JsGraph rsGraph = null; String src = null; if (authority != null && !authority.isEmpty()) { src = authority; rsGraph = new JsGraph(); rsGraph.setId(authority); rsGraph.setName(name); JsGraphNodeData dataNode = new JsGraphNodeData(); dataNode.setColor(getNodeCustomColor()); dataNode.setType(getType()); dataNode.setModeStyle("fill"); rsGraph.setData(dataNode); } else { src = name; rsGraph = new JsGraph(); rsGraph.setId(name); rsGraph.setName(name); JsGraphNodeData dataNodeLeaf = new JsGraphNodeData(); dataNodeLeaf.setColor(getNodeLeafCustomColor()); dataNodeLeaf.setType(getType()); dataNodeLeaf.setModeStyle("stroke"); rsGraph.setData(dataNodeLeaf); } if (rsGraph != null) { if (facets != null && facets.getValueCount() > 0) { for (Count facet : facets.getValues()) { if (facet.getCount() > 0) { String node2 = (String) facet.getName(); String split[] = node2.split("\\|\\|\\|"); String srcnode2 = null; String displayValue = ""; String authorityValue = null; boolean isAuthority = false; if (split.length > 1) { String[] splitAuthority = split[1].split(splitterAuthority); displayValue = splitAuthority[0]; srcnode2 = displayValue; if (splitAuthority.length > 1) { isAuthority = true; authorityValue = splitAuthority[1]; srcnode2 = authorityValue; } } else if (split.length == 1) { displayValue = split[0]; srcnode2 = displayValue; } if (!(src.equals(srcnode2))) { JsGraphAdjacence adjacence = new JsGraphAdjacence(); JsGraphData data = new JsGraphData(); adjacence.setSrc(node2); if (isAuthority) { adjacence.setNodeTo(authorityValue); } else { adjacence.setNodeTo(displayValue); } if (authorityValue != null || showExternal) { data.setColor(getEdgeCustomColor()); data.setLineWidth(getCustomLineWidth((int) facet.getCount())); data.setCount((int) facet.getCount()); data.setType(getType()); adjacence.setData(data); rsGraph.getAdjacencies().add(adjacence); } } } } } } return rsGraph; }
From source file:org.dspace.app.cris.network.AVisualizationGraph.java
public List<ResearcherPage> loadMetrics(List<String[]> discardedNode, Integer importedNodes, Boolean otherError) throws SearchServiceException { // load all publications SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery("type:" + getType() + " AND entity:" + ConstantNetwork.ENTITY_RP); solrQuery.addFacetField(FACET_METRICS); solrQuery.setFacetLimit(Integer.MAX_VALUE); solrQuery.setFacetMinCount(1); solrQuery.setRows(0);/*www .j a v a2 s .c o m*/ QueryResponse rsp = getService().search(solrQuery); FacetField facets = rsp.getFacetField(FACET_METRICS); // for each interests get authority's authors List<ResearcherPage> result = new LinkedList<ResearcherPage>(); int counter = 0; external: for (Count facetElement : facets.getValues()) { counter++; log.debug("" + counter + " of " + facets.getValueCount()); ResearcherPage researcher = null; try { String facetValue = facetElement.getName(); Integer realPersistentIdentifier = ResearcherPageUtils.getRealPersistentIdentifier(facetValue, ResearcherPage.class); researcher = applicationService.get(ResearcherPage.class, realPersistentIdentifier); //researcher.getDynamicField().setAnagraficaLazy(applicationService.getAnagraficaByRP(realPersistentIdentifier)); solrQuery = new SolrQuery(); solrQuery.setQuery("type:" + getType() + " AND entity:" + ConstantNetwork.ENTITY_RP + " AND " + FACET_METRICS + ":\"" + facetValue + "\""); solrQuery.addFacetField(FACET_SEARCH); solrQuery.setFacetMinCount(1); solrQuery.setFacetLimit(Integer.MAX_VALUE); solrQuery.setRows(0); rsp = getService().search(solrQuery); FacetField relations = rsp.getFacetField(FACET_SEARCH); int i = 0; int nConnections = 0; int maxStrength = 0; int sumStrength = 0; List<Long> quadraticVarianceArrays = new ArrayList<Long>(); nConnections = Integer.valueOf(relations.getValueCount() - 1); internal: for (Count relation : relations.getValues()) { log.debug("" + counter + " works on " + i + " of " + relations.getValueCount()); if (i == 0) { i++; continue internal; } else { if (i == 1) { // max maxStrength = Integer.valueOf((int) relation.getCount()); } sumStrength += Integer.valueOf((int) relation.getCount()); quadraticVarianceArrays.add(relation.getCount()); } i++; } RPAdditionalFieldStorage anagraficaObject = researcher.getDynamicField(); setMetadata(String.valueOf(nConnections), anagraficaObject, ConstantNetwork.PREFIX_METADATA_BIBLIOMETRIC_1 + getType()); setMetadata(String.valueOf(maxStrength), anagraficaObject, ConstantNetwork.PREFIX_METADATA_BIBLIOMETRIC_2 + getType()); double averageStrength = ((double) sumStrength / ((double) nConnections)); setMetadata(String.valueOf(df.format(averageStrength)), anagraficaObject, ConstantNetwork.PREFIX_METADATA_BIBLIOMETRIC_3 + getType()); double quadraticVariance = 0; double n = quadraticVarianceArrays.size(); for (Long variance : quadraticVarianceArrays) { quadraticVariance += ((variance - averageStrength) * (variance - averageStrength)); } quadraticVariance = Math.sqrt(quadraticVariance / n); setMetadata(String.valueOf(df.format(quadraticVariance)), anagraficaObject, ConstantNetwork.PREFIX_METADATA_BIBLIOMETRIC_4 + getType()); result.add(researcher); } catch (Exception e) { log.error("Error try to build object to index with ID:" + researcher.getId()); log.error(e.getMessage(), e); otherError = true; continue; } } committnode: for (ResearcherPage node : result) { // try // { applicationService.saveOrUpdate(ResearcherPage.class, node); boolean rr = ((CrisSearchService) getIndexer().getIndexer()).indexCrisObject(node, true); // index node if (rr) { importedNodes++; } else { discardedNode.add(new String[] { getConnectionName() + " - " + node.getId() }); } // } // catch (SolrServerException e) // { // log.error(e.getMessage(), e); // discardedNode.add(new String[] { getConnectionName() + " - " + node.getId()}); // continue committnode; // } // catch (IOException e) // { // log.error(e.getMessage(), e); // discardedNode.add(new String[] { getConnectionName() + " - " + node.getId()}); // continue committnode; // } } log.debug("commit " + getType()); getIndexer().getIndexer().commit(); return result; }
From source file:org.dspace.app.cris.network.AVisualizationGraphModeFour.java
@Override public List<VisualizationGraphNode> load(List<String[]> discardedNode, Integer importedNodes, Boolean otherError) throws Exception { // load all publications SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery(getQuery());//from w w w . ja v a 2 s . com solrQuery.addFacetField(getFacetFieldQuery()); // solrQuery.addFilterQuery("authors_fauthority:rp00001"); solrQuery.setFacetLimit(Integer.MAX_VALUE); solrQuery.setFacetMinCount(1); solrQuery.setRows(0); QueryResponse rsp = getService().getSearcher().search(solrQuery); FacetField facets = rsp.getFacetField(getFacetFieldQuery()); System.out.println(facets.getValueCount()); // for each interests get authority's authors List<VisualizationGraphNode> result = null; int counter = 0; external: for (Count facetElement : facets.getValues()) { counter++; log.debug(getConnectionName() + " - " + counter + " of " + facets.getValueCount()); System.out.println(getConnectionName() + " - " + counter + " of " + facets.getValueCount()); result = new LinkedList<VisualizationGraphNode>(); try { String facetValue = facetElement.getName(); List<String> relations = getValues(facetValue); int i = 0; internal: for (String relation : relations) { log.debug("" + counter + " works on " + i + " of " + relations.size()); System.out.println(getConnectionName() + " - " + counter + " of " + facets.getValueCount() + " works on " + i + " of " + relations.size()); String aaa = relation; String[] split = aaa.split("\\|\\|\\|"); String a = aaa; String a_authority = null; String a_dept = null; String a_displayValue = ""; if (split.length > 1) { String[] splitAuthority = split[1].split(splitterAuthority); a_displayValue = splitAuthority[0]; if (splitAuthority.length > 1) { a_authority = splitAuthority[1]; // a_dept = ResearcherPageUtils // .getDepartment(a_authority); a_dept = getDepartmentFromSOLR(a_authority); } } internalprivate: for (int j = i; j < relations.size(); j++) { List<String> values = new LinkedList<String>(); values.add(facetValue); String bbb = relations.get(j); split = bbb.split("\\|\\|\\|"); String b = bbb; String b_authority = null; String b_dept = null; String b_displayValue = ""; if (split.length > 1) { String[] splitAuthority = split[1].split(splitterAuthority); b_displayValue = splitAuthority[0]; if (splitAuthority.length > 1) { b_authority = splitAuthority[1]; // a_dept = ResearcherPageUtils // .getDepartment(a_authority); b_dept = getDepartmentFromSOLR(b_authority); } } if (j == i) { buildRow(result, a, a_authority, a_displayValue, b, b_authority, b_displayValue, values, buildExtra(facetValue), a_dept, b_dept, ConstantNetwork.ENTITY_PLACEHOLDER_RP); } else { if (!a.equals(b)) { buildRow(result, a, a_authority, a_displayValue, b, b_authority, b_displayValue, values, buildExtra(facetValue), a_dept, b_dept, ConstantNetwork.ENTITY_RP); } } } i++; } } catch (Exception e) { log.error("Error try to build object to index with ID:" + ""); log.error(e.getMessage(), e); otherError = true; continue; } importedNodes = indexNode(discardedNode, importedNodes, result); } log.debug("commit " + getType()); getIndexer().commit(); return result; }
From source file:org.dspace.app.cris.network.AVisualizationGraphModeTwo.java
@Override public List<VisualizationGraphNode> load(List<String[]> discardedNode, Integer importedNodes, Boolean otherError) throws Exception { // load all publications SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery(getQuery());//from w w w . ja va2 s .com solrQuery.addFacetField(getFacetFieldQuery()); // solrQuery.addFilterQuery("authors_fauthority:rp00001"); solrQuery.setFacetLimit(Integer.MAX_VALUE); solrQuery.setFacetMinCount(1); solrQuery.setRows(0); QueryResponse rsp = getService().getSearcher().search(solrQuery); FacetField facets = rsp.getFacetField(getFacetFieldQuery()); System.out.println(facets.getValueCount()); // for each interests get authority's authors List<VisualizationGraphNode> result = null; int counter = 0; external: for (Count facetElement : facets.getValues()) { counter++; log.debug(getConnectionName() + " - " + counter + " of " + facets.getValueCount()); System.out.println(getConnectionName() + " - " + counter + " of " + facets.getValueCount()); result = new LinkedList<VisualizationGraphNode>(); try { String facetValue = facetElement.getName(); solrQuery = new SolrQuery(); String query = (useJoin() ? getJoin() : "") + getFacetFieldQuery() + ":\"" + ClientUtils.escapeQueryChars(facetValue) + "\""; solrQuery.setQuery(query); solrQuery.addFacetField(getFacet(facetValue)); solrQuery.setFacetMinCount(1); solrQuery.setFacetLimit(getFacetLimit()); solrQuery.setRows(0); rsp = getService().getSearcher().search(solrQuery); FacetField relations = rsp.getFacetField(getFacet(facetValue)); int i = 0; internal: for (Count relation : relations.getValues()) { log.debug("" + counter + " works on " + i + " of " + relations.getValueCount()); System.out.println(getConnectionName() + " - " + counter + " of " + facets.getValueCount() + " works on " + i + " of " + relations.getValueCount()); String aaa = relation.getName(); String[] split = aaa.split("\\|\\|\\|"); String a = aaa; String a_authority = null; String a_dept = null; String a_displayValue = ""; if (split.length > 1) { String[] splitAuthority = split[1].split(splitterAuthority); a_displayValue = splitAuthority[0]; if (splitAuthority.length > 1) { a_authority = splitAuthority[1]; // a_dept = ResearcherPageUtils // .getDepartment(a_authority); a_dept = getDepartmentFromSOLR(a_authority); } } internalprivate: for (int j = i; j < relations.getValues().size(); j++) { List<String> values = new LinkedList<String>(); values.add(facetValue); String bbb = relations.getValues().get(j).getName(); split = bbb.split("\\|\\|\\|"); String b = bbb; String b_authority = null; String b_dept = null; String b_displayValue = ""; if (split.length > 1) { String[] splitAuthority = split[1].split(splitterAuthority); b_displayValue = splitAuthority[0]; if (splitAuthority.length > 1) { b_authority = splitAuthority[1]; // a_dept = ResearcherPageUtils // .getDepartment(a_authority); b_dept = getDepartmentFromSOLR(b_authority); } } if (j == i) { buildRow(result, a, a_authority, a_displayValue, b, b_authority, b_displayValue, values, buildExtra(facetValue), a_dept, b_dept, ConstantNetwork.ENTITY_PLACEHOLDER_RP); } else { if (!a.equals(b)) { buildRow(result, a, a_authority, a_displayValue, b, b_authority, b_displayValue, values, buildExtra(facetValue), a_dept, b_dept, ConstantNetwork.ENTITY_RP); } } } i++; } } catch (Exception e) { log.error("Error try to build object to index with ID:" + ""); log.error(e.getMessage(), e); otherError = true; continue; } importedNodes = indexNode(discardedNode, importedNodes, result); } log.debug("commit " + getType()); getIndexer().commit(); return result; }
From source file:org.dspace.app.cris.network.DepartmentNetworkPlugin.java
public List<VisualizationGraphNode> load(List<String[]> discardedNode, Integer importedNodes, Boolean otherError, List<String> connections) throws Exception { for (String connection : connections) { SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery("type:" + connection); solrQuery.addFacetField(FACET);//from w w w. j a v a2s .c om solrQuery.setFacetLimit(Integer.MAX_VALUE); solrQuery.setFacetMinCount(1); solrQuery.setRows(0); QueryResponse rsp = service.search(solrQuery); FacetField facets = rsp.getFacetField(FACET); // for each interests get authority's authors List<VisualizationGraphNode> result = null; int counter = 0; external: for (Count facetElement : facets.getValues()) { counter++; log.debug("" + counter + " of " + facets.getValueCount()); result = new LinkedList<VisualizationGraphNode>(); try { String facetValue = facetElement.getName(); String[] splittedFacetValue = facetValue.split("\\|\\|\\|"); if (!splittedFacetValue[0].equals("null") && splittedFacetValue[0].equals(splittedFacetValue[1])) { SolrQuery solrQuery2 = new SolrQuery(); solrQuery2.setQuery("type:" + connection + " AND " + FACET + ":\"" + ClientUtils.escapeQueryChars(facetValue) + "\" AND a_auth:[* TO *] AND b_auth:[* TO *]"); solrQuery2.addFacetField(FACET_AUTHOR); solrQuery2.setFacetMinCount(1); solrQuery2.setFacetLimit(Integer.MAX_VALUE); solrQuery2.setRows(0); QueryResponse rsp2 = service.search(solrQuery2); FacetField relations = rsp2.getFacetField(FACET_AUTHOR); int i = 0; internal: for (Count relation : relations.getValues()) { log.debug("" + counter + " works on " + i + " of " + relations.getValueCount()); List<String> values = new LinkedList<String>(); values.add(splittedFacetValue[0]); String aaa = relation.getName(); String[] split = aaa.split("\\|\\|\\|"); String a = aaa; String a_authority = null; String a_displayValue = ""; if (split.length > 1) { a_displayValue = split[1]; } if (split.length > 2) { a_authority = split[2]; } buildRow(result, splittedFacetValue[0], null, splittedFacetValue[1], a, a_authority, a_displayValue, values, buildExtra(splittedFacetValue[0]), connection); i++; } importedNodes = importNode(discardedNode, importedNodes, result); log.debug("commit DEPARTMENT " + facetValue); indexer.getSolr().commit(); } } catch (Exception e) { log.error("Error try to build object to index with ID:" + ""); log.error(e.getMessage(), e); otherError = true; continue; } } } return null; }
From source file:org.dspace.app.webui.cris.controller.PJSearchFormController.java
@Override protected Map referenceData(HttpServletRequest request) throws Exception { Map<String, Object> model = new HashMap<String, Object>(); Context context = UIUtil.obtainContext(request); EPerson currUser = context.getCurrentUser(); boolean isAdmin = AuthorizeManager.isAdmin(context); if (currUser != null) { model.put("researcher_page_menu", new Boolean(true)); }// ww w.j a v a2s . co m if (isAdmin) { model.put("see_search_grantcode", new Boolean(true)); } SolrQuery query = new SolrQuery(); query.setQuery("disabled:false"); query.setFacet(true); query.setFacetLimit(-1); query.setFacetMinCount(1); query.setFacetMissing(true); query.setFacetSort(FacetParams.FACET_SORT_INDEX); // check table name query.addFacetField("pjsponsor_filter"); query.addFacetField("pjstatus_filter"); query.setRows(0); QueryResponse qResponse = ((CrisSearchService) searchService).search(query); FacetField facetField = qResponse.getFacetField("pjsponsor_filter"); List<DiscoverResult.FacetResult> sponsors = new ArrayList<DiscoverResult.FacetResult>(); List<Count> values = facetField.getValues(); if (values != null) { for (FacetField.Count facetValue : values) { DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetField, facetValue); sponsors.add(fr); } } FacetField facetFieldStatus = qResponse.getFacetField("pjstatus_filter"); List<DiscoverResult.FacetResult> status = new ArrayList<DiscoverResult.FacetResult>(); List<Count> valuesStatus = facetFieldStatus.getValues(); if (valuesStatus != null) { for (FacetField.Count facetValue : valuesStatus) { DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetFieldStatus, facetValue); status.add(fr); } } DiscoveryConfiguration discoveryConf = SearchUtils.getDiscoveryConfigurationByName("crisproject"); List<String> searchFields = new LinkedList<String>(); for (DiscoverySearchFilter field : discoveryConf.getSearchFilters()) { searchFields.add(field.getIndexFieldName()); } model.put("state", status); model.put("sponsors", sponsors); model.put("fields", searchFields); return model; }
From source file:org.dspace.app.webui.cris.controller.RPSearchFormController.java
@Override protected Map referenceData(HttpServletRequest request) throws Exception { Map<String, Object> model = new HashMap<String, Object>(); Context context = UIUtil.obtainContext(request); EPerson currUser = context.getCurrentUser(); boolean isAdmin = AuthorizeManager.isAdmin(context); if (currUser != null) { model.put("researcher_page_menu", new Boolean(true)); }//from w w w . ja v a 2 s. c om if (isAdmin) { model.put("see_search_staffno", new Boolean(true)); model.put("see_search_rp", new Boolean(true));// not used on jsp // (now search for // RP // is public) } SolrQuery query = new SolrQuery(); query.setQuery("disabled:false"); query.setFacet(true); query.setFacetLimit(-1); query.setFacetMinCount(1); query.setFacetMissing(true); query.setFacetSort(FacetParams.FACET_SORT_INDEX); // check table name query.addFacetField("faculty_filter"); query.setRows(0); QueryResponse qResponse = ((CrisSearchService) searchService).search(query); FacetField facetField = qResponse.getFacetField("faculty_filter"); List<DiscoverResult.FacetResult> faculties = new ArrayList<DiscoverResult.FacetResult>(); List<Count> values = facetField.getValues(); if (values != null) { for (FacetField.Count facetValue : values) { DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetField, facetValue); faculties.add(fr); } } DiscoveryConfiguration discoveryConf = SearchUtils.getDiscoveryConfigurationByName("crisrp"); List<String> searchFields = new LinkedList<String>(); for (DiscoverySearchFilter field : discoveryConf.getSearchFilters()) { searchFields.add(field.getIndexFieldName()); } model.put("faculties", faculties); model.put("fields", searchFields); return model; }
From source file:org.dspace.app.webui.cris.servlet.DeptNetworkServlet.java
private QueryResponse shootQuery(String query, boolean facet, String facetField) throws SearchServiceException { SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery(query);/*from w ww .java 2s . c o m*/ solrQuery.setStart(0); solrQuery.setRows(0); if (facet) { solrQuery.setFacet(true); solrQuery.setFacetMinCount(1); solrQuery.addFacetField(facetField); } QueryResponse rsp = service.search(solrQuery); return rsp; }
From source file:org.dspace.app.webui.cris.servlet.ProfileResearcherNetworkServlet.java
public Map<String, Integer> getRelations(String from, String to) throws SearchServiceException { Map<String, Integer> result = new HashMap<String, Integer>(); SolrQuery solrQuery = new SolrQuery(); Matcher matcher = patternRP.matcher(from); String field1 = ""; String field2 = ""; if (matcher.find()) { field1 = "focus_auth"; } else {//from www. j a v a 2 s . co m field1 = "focus_val"; } matcher = patternRP.matcher(to); if (matcher.find()) { field2 = "focus_auth"; } else { field2 = "focus_val"; } solrQuery.setQuery( field1 + ":\"" + from + "\" AND " + field2 + ":\"" + to + "\"" ); solrQuery.setFacet(true); solrQuery.addFacetField("type"); solrQuery.setFacetLimit(Integer.MAX_VALUE); solrQuery.setFacetMinCount(1); solrQuery.setRows(0); QueryResponse rsp = service.search(solrQuery); FacetField facets = rsp.getFacetField("type"); for (Count facet : facets.getValues()) { result.put(facet.getName(), Integer.valueOf((int) facet.getCount())); } return result; }