Minor tweak to getSnippets() method of PagedSearchController
This commit is contained in:
parent
e1c19ba56e
commit
1674c103a8
2 changed files with 6 additions and 5 deletions
|
@ -445,8 +445,9 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
||||||
private String getSnippet(SolrDocument doc, QueryResponse response) {
|
private String getSnippet(SolrDocument doc, QueryResponse response) {
|
||||||
String docId = doc.get(VitroSearchTermNames.DOCID).toString();
|
String docId = doc.get(VitroSearchTermNames.DOCID).toString();
|
||||||
StringBuffer text = new StringBuffer("");
|
StringBuffer text = new StringBuffer("");
|
||||||
if (response.getHighlighting() != null && response.getHighlighting().get(docId) != null) {
|
Map<String, Map<String, List<String>>> highlights = response.getHighlighting();
|
||||||
List<String> snippets = response.getHighlighting().get(docId).get(VitroSearchTermNames.ALLTEXT);
|
if (highlights != null && highlights.get(docId) != null) {
|
||||||
|
List<String> snippets = highlights.get(docId).get(VitroSearchTermNames.ALLTEXT);
|
||||||
if (snippets != null && snippets.size() > 0) {
|
if (snippets != null && snippets.size() > 0) {
|
||||||
text.append("... " + snippets.get(0) + " ...");
|
text.append("... " + snippets.get(0) + " ...");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue