private QueryResponse searchQuery(String idFieldName, boolean includeCyclic) throws SolrServerException { SolrQuery query = new SolrQuery(idFieldName+":\""+id+"\""); query.setRows(Integer.MAX_VALUE); // query.addFilterQuery("+"+OntologyFieldNames.CYCLIC+":"+String.valueOf(includeCyclic)); // query.addFilterQuery("+"+OntologyFieldNames.RELATIONSHIP_TYPE+":\"OBO_REL:is_a\""); // // if (!includeCyclic) { // query.addFilterQuery("-"+OntologyFieldNames.RELATIONSHIP_TYPE+":disjoint_from"); // } // query.setSortField(OntologyFieldNames.CHILD_NAME+"_s", SolrQuery.ORDER.asc); return searcher.search(query); }
private List<OntologyTerm> searchById(String fieldId, String id, Integer firstResult, Integer maxResults) throws SolrServerException { SolrQuery query = new SolrQuery(fieldId + ":\"" + id + "\""); if (firstResult != null) query.setStart(firstResult); if (maxResults != null) query.setRows(maxResults); if (FieldName.CHILDREN_ID.equalsIgnoreCase(fieldId)){ return processParentsHits(search(query, new String[] {OntologyFieldNames.PARENT_ID, OntologyFieldNames.PARENT_NAME, OntologyFieldNames.PARENT_SYNONYMS}), id); } else if (FieldName.PARENT_ID.equalsIgnoreCase(fieldId)) { return processChildrenHits(search(query, new String[] {OntologyFieldNames.CHILD_ID, OntologyFieldNames.CHILD_NAME, OntologyFieldNames.CHILDREN_SYNONYMS}), id); } else { return processParentsHits(search(query, new String[] {OntologyFieldNames.PARENT_ID, OntologyFieldNames.PARENT_NAME, OntologyFieldNames.PARENT_SYNONYMS}), id); } }
private QueryResponse searchById(String fieldId, String id, Integer firstResult, Integer maxResults) throws SolrServerException { SolrQuery query = new SolrQuery(fieldId + ":\"" + id + "\""); if (firstResult != null) query.setStart(firstResult); if (maxResults != null) query.setRows(maxResults); return search(query); } }
private OntologyNames searchOntologyNamesByName(String fieldId, String name, Integer firstResult, Integer maxResults) throws SolrServerException { SolrQuery query = new SolrQuery(fieldId + ":\"" + name + "\""); if (firstResult != null) query.setStart(firstResult); if (maxResults != null) query.setRows(maxResults); QueryResponse response = search(query, new String[] {OntologyFieldNames.CHILD_NAME, OntologyFieldNames.CHILDREN_SYNONYMS, OntologyFieldNames.CHILD_ID}); return extractNamesAndSynonymsFrom(response); }
private OntologyNames searchOntologyNamesById(String fieldId, String id, Integer firstResult, Integer maxResults) throws SolrServerException { SolrQuery query = new SolrQuery(fieldId + ":\"" + id + "\""); if (firstResult != null) query.setStart(firstResult); if (maxResults != null) query.setRows(maxResults); QueryResponse response = search(query, new String[] {OntologyFieldNames.CHILD_NAME, OntologyFieldNames.CHILDREN_SYNONYMS, OntologyFieldNames.CHILD_ID}); return extractNamesAndSynonymsFrom(response); }
public Set<String> getOntologyNames() throws SolrServerException { if (ontologyNames == null) { SolrQuery query = new SolrQuery("*:*"); query.setStart(0); query.setRows(0); query.setFacet(true); query.setParam(FacetParams.FACET_FIELD, "ontology"); QueryResponse response = search(query); FacetField facetField = response.getFacetField("ontology"); if (facetField.getValues() == null) { return Collections.EMPTY_SET; } ontologyNames = new HashSet<String>( facetField.getValues().size() ); for (FacetField.Count c : facetField.getValues()) { ontologyNames.add(c.getName()); } } return ontologyNames; }
public Set<String> getOntologyNames() throws SolrServerException { if (ontologyNames == null) { SolrQuery query = new SolrQuery("*:*"); query.setStart(0); query.setRows(0); // prepare faceting query.setFacet(true); query.setParam(FacetParams.FACET_FIELD, "ontology"); query.setFacetLimit(10); query.setFacetMinCount(1); query.set(FacetParams.FACET_OFFSET, 0); // order by unique id query.addSortField(OntologyFieldNames.ID, SolrQuery.ORDER.asc); QueryResponse response = search(query, null); FacetField facetField = response.getFacetField("ontology"); if (facetField.getValues() == null) { return Collections.EMPTY_SET; } ontologyNames = new HashSet<String>( facetField.getValues().size() ); for (FacetField.Count c : facetField.getValues()) { ontologyNames.add(c.getName()); } } return ontologyNames; }