Skip to content

Commit

Permalink
Fix for missing fields not passed from Java to Solr. #386
Browse files Browse the repository at this point in the history
  • Loading branch information
henrietteharmse committed Aug 10, 2023
1 parent 9ca43ca commit 7722678
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public static List<String> mapFieldsList(Collection<String> ols3FieldNames) {
}

if (legacyFieldName.indexOf('^') != -1) {
suffix = legacyFieldName.substring(legacyFieldName.indexOf('^') + 1);
legacyFieldName = legacyFieldName.substring(0, legacyFieldName.indexOf('^') - 1);
suffix = legacyFieldName.substring(legacyFieldName.indexOf('^'));
legacyFieldName = legacyFieldName.substring(0, legacyFieldName.indexOf('^'));
}

if (legacyFieldName.equals("iri")) {
Expand Down Expand Up @@ -71,17 +71,15 @@ public static List<String> mapFieldsList(Collection<String> ols3FieldNames) {
continue;
}

if (legacyFieldName.equals("ontology_name")) {
newFields.add(prefix + "ontologyId" + suffix);
continue;
}

if (legacyFieldName.equals("type")) {
newFields.add(prefix + "type" + suffix);
continue;
}


if (legacyFieldName.equals("_json")) {
newFields.add("_json" + suffix);
continue;
}
}

// escape special characters in field names for solr query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void search(
solrQuery.set("defType", "edismax");
solrQuery.setQuery(query);

String[] fields = {"label^5", "synonym^3", "definition", "short_form^2", "obo_id^2", /*"annotations", "logical_description",*/ "iri"};
String[] fields = {"label^5", "synonym^3", "definition", "short_form^2", "obo_id^2", "iri", "_json"};

solrQuery.set("qf", String.join(" ", SolrFieldMapper.mapFieldsList(List.of(fields))));

Expand Down

0 comments on commit 7722678

Please sign in to comment.