Skip to content

Commit 46daaa6

Browse files
authored
Merge pull request #1203 from EBISPOT/fix-search-issue
Fixes search issue
2 parents f108b0c + 4ea78f8 commit 46daaa6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v1/SolrFieldMapper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public static List<String> mapFieldsList(Collection<String> ols3FieldNames) {
3131
} else if (legacyFieldName.endsWith("_e")) {
3232
prefix = "edge_";
3333
legacyFieldName = legacyFieldName.substring(0, legacyFieldName.length() - 2);
34+
} else if (legacyFieldName.endsWith("_w")) {
35+
prefix = "whitespace_";
36+
legacyFieldName = legacyFieldName.substring(0, legacyFieldName.length() - 2);
3437
}
3538

3639
if (legacyFieldName.equals("iri")) {

backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v1/V1SearchController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ public void search(
142142
solrQuery.set("defType", "edismax");
143143
solrQuery.setQuery(query);
144144

145-
String[] fields = {LABEL.getText()+"_s^5", SYNONYM.getText()+"_s^3", DEFINITION.getText(), "short_form_s^2", "obo_id_s^2", "iri_s", "annotations_trimmed", "curatedFrom_s^0.5"};
146-
145+
String[] fields = {LABEL.getText()+"_w^5", SYNONYM.getText()+"_w^3", DEFINITION.getText()+"_w", "short_form_w^2", "obo_id_w^2", "iri_s", "annotations_trimmed_w", "curatedFrom_w^0.5"};
147146
solrQuery.set("qf", String.join(" ", SolrFieldMapper.mapFieldsList(List.of(fields))));
148147

149148
solrQuery.set("bq",
@@ -174,7 +173,8 @@ public void search(
174173
for(String ontologyId : ontologies)
175174
Validation.validateOntologyId(ontologyId);
176175

177-
solrQuery.addFilterQuery("ontologyId: (" + String.join(" OR ", ontologies) + ")");
176+
List<String> lowercasedOntologies = ontologies.stream().map(String::toLowerCase).collect(Collectors.toList());
177+
solrQuery.addFilterQuery("ontologyId: (" + String.join(" OR ", lowercasedOntologies) + ")");
178178
}
179179

180180
if (slims != null) {

0 commit comments

Comments
 (0)