Skip to content

Commit

Permalink
Merge pull request #569 from EBISPOT/#549
Browse files Browse the repository at this point in the history
Fixes for #568 and #549
  • Loading branch information
henrietteharmse authored Nov 8, 2023
2 parents 549048e + f8d8a15 commit b38aae9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public SolrQuery constructQuery() {
if(qf.length() > 0) {
qf.append(" ");
}
qf.append(ClientUtils.escapeQueryChars( getSolrPropertyName(searchField.propertyName, exactMatch ? SearchType.WHOLE_FIELD : searchField.searchType)) );
qf.append(ClientUtils.escapeQueryChars( getSolrPropertyName(searchField.propertyName,
exactMatch ? SearchType.WHOLE_FIELD : searchField.searchType)) );
qf.append("^");
qf.append(searchField.weight);
}
Expand Down Expand Up @@ -177,22 +178,25 @@ public BoostField(String propertyName, String propertyValue, int weight, SearchT
}

private String getSolrPropertyName(String propertyName, SearchType searchType) {
switch(searchType) {
case CASE_INSENSITIVE_TOKENS:
return "lowercase_" + propertyName;
case CASE_SENSITIVE_TOKENS:
return propertyName;
case WHOLE_FIELD:
return "str_" + propertyName;
case EDGES:
return "edge_" + propertyName;
case WHITESPACE:
return "whitespace_" + propertyName;
case WHITESPACE_EDGES:
return "whitespace_edge_" + propertyName;
default:
throw new RuntimeException("unknown filter accuracy");
}
if (propertyName.compareTo("_json") == 0)
return propertyName;
else
switch(searchType) {
case CASE_INSENSITIVE_TOKENS:
return "lowercase_" + propertyName;
case CASE_SENSITIVE_TOKENS:
return propertyName;
case WHOLE_FIELD:
return "str_" + propertyName;
case EDGES:
return "edge_" + propertyName;
case WHITESPACE:
return "whitespace_" + propertyName;
case WHITESPACE_EDGES:
return "whitespace_edge_" + propertyName;
default:
throw new RuntimeException("unknown filter accuracy");
}
}

private String getSolrPropertyValue(String propertyValue, SearchType searchType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static void addSearchFieldsToQuery(OlsSolrQuery query, String searchField
query.addSearchField(field.property, field.weight, SearchType.CASE_INSENSITIVE_TOKENS);
}
}
query.addSearchField("_json", 1, SearchType.CASE_INSENSITIVE_TOKENS);
}

public static void addBoostFieldsToQuery(OlsSolrQuery query, String boostFields) {
Expand Down

0 comments on commit b38aae9

Please sign in to comment.