fix for search requests in GSA interface which contain 'funny'

characters (like ':' etc.)
pull/1/head
Michael Peter Christen 11 years ago
parent b085cb522b
commit 69b8d61c47

@ -163,7 +163,7 @@ public class searchresult {
CollectionSchema.last_modified.getSolrFieldName() + ',' +
CollectionSchema.size_i.getSolrFieldName());
post.put("hl", "true");
post.put("hl.q", originalQuery);
post.put("hl.q", qg.getIncludeString());
post.put("hl.fl", CollectionSchema.h1_txt.getSolrFieldName() + "," + CollectionSchema.h2_txt.getSolrFieldName() + "," + CollectionSchema.text_t.getSolrFieldName());
post.put("hl.alternateField", CollectionSchema.description_txt.getSolrFieldName());
post.put("hl.simple.pre", "<b>");

@ -45,7 +45,7 @@ public class QueryGoal {
private static char space = ' ';
private static char sq = '\'';
private static char dq = '"';
private static String seps = ".,/&_";
private static String seps = ".:;#'*`,!$%()=?^<>/&_";
private String query_original;
private HandleSet include_hashes, exclude_hashes;
@ -165,6 +165,17 @@ public class QueryGoal {
return exclude_hashes;
}
/**
* the include string may be useful (and better) for highlight/snippet computation
* @return the query string containing only the positive literals (includes) and without whitespace characters
*/
public String getIncludeString() {
if (this.include_strings.size() == 0) return "";
StringBuilder sb = new StringBuilder(10 * include_strings.size());
for (String s: this.include_strings) sb.append(s).append(' ');
return sb.toString().substring(0, sb.length() - 1);
}
public ArrayList<String> getIncludeStrings() {
return include_strings;
}

Loading…
Cancel
Save