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) {
|
||||
String docId = doc.get(VitroSearchTermNames.DOCID).toString();
|
||||
StringBuffer text = new StringBuffer("");
|
||||
if (response.getHighlighting() != null && response.getHighlighting().get(docId) != null) {
|
||||
List<String> snippets = response.getHighlighting().get(docId).get(VitroSearchTermNames.ALLTEXT);
|
||||
Map<String, Map<String, List<String>>> highlights = response.getHighlighting();
|
||||
if (highlights != null && highlights.get(docId) != null) {
|
||||
List<String> snippets = highlights.get(docId).get(VitroSearchTermNames.ALLTEXT);
|
||||
if (snippets != null && snippets.size() > 0) {
|
||||
text.append("... " + snippets.get(0) + " ...");
|
||||
}
|
||||
|
|
|
@ -158,9 +158,9 @@ public class IndividualToSolrDocument {
|
|||
Iterator<DataPropertyStatement> dataPropertyStmtIter = dataPropertyStatements.iterator();
|
||||
while (dataPropertyStmtIter.hasNext()) {
|
||||
DataPropertyStatement dataPropertyStmt = dataPropertyStmtIter.next();
|
||||
if(dataPropertyStmt.getDatapropURI().equals(label)){ // we don't want label to be added to alltext
|
||||
continue;
|
||||
}
|
||||
if(dataPropertyStmt.getDatapropURI().equals(label)){ // we don't want label to be added to alltext
|
||||
continue;
|
||||
}
|
||||
allTextValue.append(" ");
|
||||
allTextValue.append(((t=dataPropertyStmt.getData()) == null)?"":t);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue