Skip to content

Commit

Permalink
Filter by is-funding-org only on funding requests, and, filter by ROR…
Browse files Browse the repository at this point in the history
… in all affiliation requests
  • Loading branch information
amontenegro committed Jan 31, 2024
1 parent ca8c85e commit 6aa06fd
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@ public List<OrgDisambiguatedSolrDocument> getOrgs(String searchTerm, int firstRe
StringBuilder queryString = new StringBuilder(SOLR_ORGS_QUERY.replace("%s", searchTerm));
if (fundersOnly) {
queryString.append(" AND is-funding-org:true");
} else {
queryString.append(" AND is-funding-org:false");
}
}

SolrQuery query = new SolrQuery();
query.setQuery(queryString.toString());
query.addOrUpdateSort("score", ORDER.desc);
query.addOrUpdateSort("org-disambiguated-popularity", ORDER.desc);
if(fundersOnly) {
query.addFilterQuery(String.format("(%s:(%s OR %s))", SolrConstants.ORG_DISAMBIGUATED_ID_SOURCE_TYPE, "ROR", "FUNDREF"));
} else {
query.addFilterQuery(String.format("(%s:(%s))", SolrConstants.ORG_DISAMBIGUATED_ID_SOURCE_TYPE, "ROR"));
}

query.addFilterQuery(String.format("(%s:(%s OR %s))", SolrConstants.ORG_DISAMBIGUATED_ID_SOURCE_TYPE, "ROR", "FUNDREF"));
LOGGER.debug("SOLR Query: " + query.toQueryString());

try {
Expand Down

0 comments on commit 6aa06fd

Please sign in to comment.