Changeset 30057
- Timestamp:
- 2015-07-25T07:27:52+12:00 (8 years ago)
- Location:
- gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrRetrieve.java
r24641 r30057 20 20 21 21 import org.apache.log4j.Logger; 22 import org.greenstone.gsdl3.core.GSException; 23 import org.greenstone.gsdl3.util.GSXML; 24 import org.w3c.dom.Document; 25 import org.w3c.dom.Element; 26 import org.w3c.dom.Text; 22 27 23 28 /** Does excatly the same as GS2LuceneRetrieve. Wrap up in a bit of … … 37 42 super(); 38 43 } 44 @Override 45 protected Element getNodeContent(Document doc, String doc_id, String lang) throws GSException 46 { 47 // IF we need only process our content by macro resolver 48 if (highlightedNode != null) 49 { 50 String highlightedTextContent = highlightedNode.getTextContent(); 51 52 //Process text 53 highlightedTextContent = resolveTextMacros(highlightedTextContent, doc_id, lang); 54 //Create result element 55 Element highlighted_node = doc.createElement(GSXML.NODE_CONTENT_ELEM); 56 Text hlt = doc.createTextNode(highlightedTextContent); 57 highlighted_node.appendChild(hlt); 58 return highlighted_node; 59 } 60 return super.getNodeContent(doc, doc_id, lang); 61 62 } 39 63 } 40 64 -
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java
r30050 r30057 348 348 { 349 349 String rslt = this.solr_src.runHighlightingQuery(query,hldocOID); 350 // Check result 351 if (rslt != null) 352 { 350 353 return rslt; 354 } 355 //Highlighting request failed. Do standard request. 356 hldocOID = null; 351 357 } 352 358 SharedSoleneQueryResult sqr = this.solr_src.runQuery(query); -
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/util/SolrQueryWrapper.java
r30050 r30057 559 559 //Get highliting results 560 560 Map<String,Map<String,List<String>>> highlightingResults = solrResponse.getHighlighting(); 561 //Get highlited document text 562 text = highlightingResults.get(hldocOID).get(highlight_field).get(0); 563 564 561 // Check for existing highlighting results 562 if (highlightingResults != null && highlightingResults.get(hldocOID) != null && highlightingResults.get(hldocOID).get(highlight_field) != null) 563 { 564 //Get highlited document text 565 text = highlightingResults.get(hldocOID).get(highlight_field).get(0); 566 } 565 567 } 566 568 catch (SolrServerException server_exception)
Note:
See TracChangeset
for help on using the changeset viewer.