Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java	(revision 31248)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java	(revision 31249)
@@ -225,5 +225,5 @@
 		if (document_type == null)
 		{
-		    logger.error("doctype is null!!!***********");
+		    logger.debug("doctype is null, setting to simple");
 		    document_type = GSXML.DOC_TYPE_SIMPLE;
 		}
@@ -310,5 +310,5 @@
 		else
 		{
-			// we dont need any structure
+		  // we dont need any structure
 		}
 
@@ -526,5 +526,4 @@
 			dc_request.appendChild(basic_doc_list);
 		}
-		logger.debug("request = " + XMLConverter.getString(dc_message));
 		Element dc_response_message = (Element) this.mr.process(dc_message);
 		if (processErrorElements(dc_response_message, page_response))
@@ -532,5 +531,4 @@
 			return result;
 		}
-
 		Element dc_response_doc_list = (Element) GSXML.getNodeByPath(dc_response_message, path);
 
@@ -541,11 +539,13 @@
 			for (int i = 0; i < doc_nodes.getLength(); i++)
 			{
-				Node content = GSXML.getChildByTagName((Element) dc_response_docs.item(i), "nodeContent");
+				Node content = GSXML.getChildByTagName((Element) dc_response_docs.item(i), GSXML.NODE_CONTENT_ELEM);
 				if (content != null)
 				{
 					if (highlight_query_terms)
 					{
-						content = highlightQueryTerms(request, (Element) content);
+					  String node_id = ((Element)doc_nodes.item(i)).getAttribute(GSXML.NODE_ID_ATT);
+					  content = highlightQueryTerms(request, node_id, (Element) content);
 					}
+					
 					doc_nodes.item(i).appendChild(doc.importNode(content, true));
 				}
@@ -597,5 +597,5 @@
 				dc_response_doc.removeChild(dc_response_doc_content);
 
-				dc_response_doc_content = highlightQueryTerms(request, dc_response_doc_content);
+				dc_response_doc_content = highlightQueryTerms(request, null, dc_response_doc_content);
 				dc_response_doc.appendChild(dc_response_doc.getOwnerDocument().importNode(dc_response_doc_content, true));
 			}
@@ -839,5 +839,5 @@
 	 * found in the text.
 	 */
-	protected Element highlightQueryTerms(Element request, Element dc_response_doc_content)
+  protected Element highlightQueryTerms(Element request, String current_node_id, Element dc_response_doc_content)
 	{
 		Document doc = request.getOwnerDocument();
@@ -871,12 +871,15 @@
 		Element query_param_list = doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
 		GSXML.addParametersToList(query_param_list, service_params);
-		GSXML.addParameterToList(query_param_list, "hldocOID", (String) params.get(GSParams.DOCUMENT));
+		if (current_node_id != null) {
+		  GSXML.addParameterToList(query_param_list, "hldocOID", current_node_id);
+		} else {
+		  GSXML.addParameterToList(query_param_list, "hldocOID", (String) params.get(GSParams.DOCUMENT));
+		}
 		mr_query_request.appendChild(query_param_list);
-
 		// do the query
 		Element mr_query_response = (Element) this.mr.process(mr_query_message);
-				
 		String pathNode = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.NODE_CONTENT_ELEM);
 		Element highlighted_Node = (Element) GSXML.getNodeByPath(mr_query_response, pathNode);
+		// 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
 		if (highlighted_Node != null)
 		{
@@ -900,6 +903,6 @@
 			//Append highlighted content to request for processing
 			dc_request.appendChild(doc.importNode(highlighted_Node, true));
-							
 			Element hl_response_message = (Element) this.mr.process(hl_message);
+		
 			//Get results
 			NodeList contentList = hl_response_message.getElementsByTagName(GSXML.NODE_CONTENT_ELEM);
@@ -907,5 +910,4 @@
 			return content;
 		}
-
 		String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.TERM_ELEM + GSXML.LIST_MODIFIER);
 		Element query_term_list_element = (Element) GSXML.getNodeByPath(mr_query_response, path);
