Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
fix for #307
Browse files Browse the repository at this point in the history
  • Loading branch information
westei committed Apr 2, 2019
1 parent 3d279f7 commit 8200436
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.redlink.smarti.lib.solr.iterms;

import org.apache.solr.client.solrj.util.ClientUtils;

public class ContextTerm {

private final String field;
Expand Down Expand Up @@ -33,11 +35,12 @@ public String getTerm() {
return term;
}
/**
* The combination of <code>&lt;field&gt;:&lt;term&gt;</code> as used by Solr
* The combination of <code>&lt;field&gt;:&lt;term&gt;</code> as used by Solr.
* Also escapes query chars from the term
* @return '<code>&lt;field&gt;:&lt;term&gt;</code>' or '<code>&lt;term&gt;</code>' if the field is <code>null</code>
*/
*/ //#307: the term needs to be query escaped
public String getSolrTerm() {
return field == null ? term : field + ':' + term;
return (field == null ? "" : field + ':') + ClientUtils.escapeQueryChars(term);
}

public float getRelevance() {
Expand Down

0 comments on commit 8200436

Please sign in to comment.