- Timestamp:
- 2016-12-19T14:37:31+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r30554 r31249 225 225 if (document_type == null) 226 226 { 227 logger. error("doctype is null!!!***********");227 logger.debug("doctype is null, setting to simple"); 228 228 document_type = GSXML.DOC_TYPE_SIMPLE; 229 229 } … … 310 310 else 311 311 { 312 312 // we dont need any structure 313 313 } 314 314 … … 526 526 dc_request.appendChild(basic_doc_list); 527 527 } 528 logger.debug("request = " + XMLConverter.getString(dc_message));529 528 Element dc_response_message = (Element) this.mr.process(dc_message); 530 529 if (processErrorElements(dc_response_message, page_response)) … … 532 531 return result; 533 532 } 534 535 533 Element dc_response_doc_list = (Element) GSXML.getNodeByPath(dc_response_message, path); 536 534 … … 541 539 for (int i = 0; i < doc_nodes.getLength(); i++) 542 540 { 543 Node content = GSXML.getChildByTagName((Element) dc_response_docs.item(i), "nodeContent");541 Node content = GSXML.getChildByTagName((Element) dc_response_docs.item(i), GSXML.NODE_CONTENT_ELEM); 544 542 if (content != null) 545 543 { 546 544 if (highlight_query_terms) 547 545 { 548 content = highlightQueryTerms(request, (Element) content); 546 String node_id = ((Element)doc_nodes.item(i)).getAttribute(GSXML.NODE_ID_ATT); 547 content = highlightQueryTerms(request, node_id, (Element) content); 549 548 } 549 550 550 doc_nodes.item(i).appendChild(doc.importNode(content, true)); 551 551 } … … 597 597 dc_response_doc.removeChild(dc_response_doc_content); 598 598 599 dc_response_doc_content = highlightQueryTerms(request, dc_response_doc_content);599 dc_response_doc_content = highlightQueryTerms(request, null, dc_response_doc_content); 600 600 dc_response_doc.appendChild(dc_response_doc.getOwnerDocument().importNode(dc_response_doc_content, true)); 601 601 } … … 839 839 * found in the text. 840 840 */ 841 protected Element highlightQueryTerms(Element request, Element dc_response_doc_content)841 protected Element highlightQueryTerms(Element request, String current_node_id, Element dc_response_doc_content) 842 842 { 843 843 Document doc = request.getOwnerDocument(); … … 871 871 Element query_param_list = doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 872 872 GSXML.addParametersToList(query_param_list, service_params); 873 GSXML.addParameterToList(query_param_list, "hldocOID", (String) params.get(GSParams.DOCUMENT)); 873 if (current_node_id != null) { 874 GSXML.addParameterToList(query_param_list, "hldocOID", current_node_id); 875 } else { 876 GSXML.addParameterToList(query_param_list, "hldocOID", (String) params.get(GSParams.DOCUMENT)); 877 } 874 878 mr_query_request.appendChild(query_param_list); 875 876 879 // do the query 877 880 Element mr_query_response = (Element) this.mr.process(mr_query_message); 878 879 881 String pathNode = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.NODE_CONTENT_ELEM); 880 882 Element highlighted_Node = (Element) GSXML.getNodeByPath(mr_query_response, pathNode); 883 // For SOLR, the above query may come back with a nodeContent element, which is the hldocOID section content, with search terms marked up. We send it back to the documnetContentRetrieve service so that resolveTextMacros can be applied, and it can be properly encased in documentNode etc elements 881 884 if (highlighted_Node != null) 882 885 { … … 900 903 //Append highlighted content to request for processing 901 904 dc_request.appendChild(doc.importNode(highlighted_Node, true)); 902 903 905 Element hl_response_message = (Element) this.mr.process(hl_message); 906 904 907 //Get results 905 908 NodeList contentList = hl_response_message.getElementsByTagName(GSXML.NODE_CONTENT_ELEM); … … 907 910 return content; 908 911 } 909 910 912 String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.TERM_ELEM + GSXML.LIST_MODIFIER); 911 913 Element query_term_list_element = (Element) GSXML.getNodeByPath(mr_query_response, path);
Note:
See TracChangeset
for help on using the changeset viewer.