@Test public void escapeTermsInQuery() { assertEquals("\"term1\" \"term2\" \"quoted term3\" \"term4!@#$%()\"", unit.escapeTermsInQuery("term1 term2 \"quoted term3\" term4!@#$%()")); assertEquals("\"term1\" \"term2\" \"quoted term3\" \"term4!@\"#\"$%()\"", unit.escapeTermsInQuery("term1 term2 \"quoted term3\" term4!@\"#\"$%()")); assertEquals("", unit.escapeTermsInQuery(null)); assertEquals("", unit.escapeTermsInQuery("")); assertEquals("", unit.escapeTermsInQuery(" ")); }
public String escapeTermsInQuery(String query) { if (StringUtils.isEmpty(query)) { return ""; } query = query.trim(); StringBuilder sb = new StringBuilder(); for (String term : getSearchTerms(query)) { if (term.endsWith("\"") && term.startsWith("\"")) { sb.append(" ").append(term); } else { sb.append(" \"").append(term).append("\""); } } return sb.toString().trim(); }
FacetedSearchService { public String escapeTermsInQuery(String query) { if (StringUtils.isEmpty(query)) { return ""; } query = query.trim(); StringBuilder sb = new StringBuilder(); for (String term : getSearchTerms(query)) { if (term.endsWith("\"") && term.startsWith("\"")) { sb.append(" ").append(term); } else { sb.append(" \"").append(term).append("\""); } } return sb.toString().trim(); } }
FacetedSearchService { public String escapeTermsInQuery(String query) { if (StringUtils.isEmpty(query)) { return ""; } query = query.trim(); StringBuilder sb = new StringBuilder(); for (String term : getSearchTerms(query)) { if (term.endsWith("\"") && term.startsWith("\"")) { sb.append(" ").append(term); } else { sb.append(" \"").append(term).append("\""); } } return sb.toString().trim(); }  }
FacetedSearchService { public String escapeTermsInQuery(String query) { if (StringUtils.isEmpty(query)) { return ""; } query = query.trim(); StringBuilder sb = new StringBuilder(); for (String term : getSearchTerms(query)) { if (term.endsWith("\"") && term.startsWith("\"")) { sb.append(" ").append(term); } else { sb.append(" \"").append(term).append("\""); } } return sb.toString().trim(); }  String buildHiddenDocumentsFilter(); String getFacetKeys(); String buildSolrQuery(String filter); String updateQueryWithExcludedObjects(String query, String rowQueryParameters); String replaceEventTypeName(String solrResult); String escapeQueryChars(String s); String escapeTermsInQuery(String query); SearchConfig getSearchConfig(); void setSearchConfig(SearchConfig searchConfig); AuditEventConfig getAuditEventConfig(); void setAuditEventConfig(AuditEventConfig auditEventConfig); JSONObject getParentDocumentJsonObject(Authentication authentication, String res); ExecuteSolrQuery getExecuteSolrQuery(); void setExecuteSolrQuery(ExecuteSolrQuery executeSolrQuery); }
FacetedSearchService { public String escapeTermsInQuery(String query) { if (StringUtils.isEmpty(query)) { return ""; } query = query.trim(); StringBuilder sb = new StringBuilder(); for (String term : getSearchTerms(query)) { if (term.endsWith("\"") && term.startsWith("\"")) { sb.append(" ").append(term); } else { sb.append(" \"").append(term).append("\""); } } return sb.toString().trim(); }  String buildHiddenDocumentsFilter(); String getFacetKeys(); String buildSolrQuery(String filter); String updateQueryWithExcludedObjects(String query, String rowQueryParameters); String replaceEventTypeName(String solrResult); String escapeQueryChars(String s); String escapeTermsInQuery(String query); SearchConfig getSearchConfig(); void setSearchConfig(SearchConfig searchConfig); AuditEventConfig getAuditEventConfig(); void setAuditEventConfig(AuditEventConfig auditEventConfig); JSONObject getParentDocumentJsonObject(Authentication authentication, String res); ExecuteSolrQuery getExecuteSolrQuery(); void setExecuteSolrQuery(ExecuteSolrQuery executeSolrQuery);  }