Changeset 28967 for gs3-extensions/solr

Show
Ignore:
Timestamp:
10.04.2014 14:40:34 (5 years ago)
Author:
kjdon
Message:

no longer have this.doc to use. Need to create new Documents when needed

Location:
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java

    r28065 r28967  
    4343import org.greenstone.gsdl3.util.SolrQueryWrapper; 
    4444import org.greenstone.util.GlobalProperties; 
     45import org.w3c.dom.Document; 
    4546import org.w3c.dom.Element; 
    4647import org.w3c.dom.NodeList; 
     
    422423    protected boolean addTermInfo(Element term_list, HashMap params, Object query_result) 
    423424    { 
     425      Document doc = term_list.getOwnerDocument(); 
    424426        String query_level = (String) params.get(LEVEL_PARAM); // the current query level 
    425427 
     
    429431            SharedSoleneQueryResult.TermInfo term_info = (SharedSoleneQueryResult.TermInfo) terms.get(t); 
    430432 
    431             Element term_elem = this.doc.createElement(GSXML.TERM_ELEM); 
     433            Element term_elem = doc.createElement(GSXML.TERM_ELEM); 
    432434            term_elem.setAttribute(GSXML.NAME_ATT, term_info.term_); 
    433435            term_elem.setAttribute(FREQ_ATT, "" + term_info.term_freq_); 
     
    442444            String stopword = (String) stopwords.get(t); 
    443445 
    444             Element stopword_elem = this.doc.createElement(GSXML.STOPWORD_ELEM); 
     446            Element stopword_elem = doc.createElement(GSXML.STOPWORD_ELEM); 
    445447            stopword_elem.setAttribute(GSXML.NAME_ATT, stopword); 
    446448            term_list.appendChild(stopword_elem); 
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java

    r25909 r28967  
    179179    protected Element processTextQuery(Element request) { 
    180180 
    181     Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 
    182     Element doc_node_list = this.doc.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 
    183     Element metadata_list = this.doc.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 
     181      Document result_doc = XMLConverter.newDOM(); 
     182    Element result = result_doc.createElement(GSXML.RESPONSE_ELEM); 
     183    Element doc_node_list = result_doc.createElement(GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 
     184    Element metadata_list = result_doc.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 
    184185    initResultElement(result,doc_node_list,metadata_list); 
    185186 
     
    220221        if (hits != null) { 
    221222        // or should this be docs.getNumFound() ?? 
    222         GSXML.addMetadata(this.doc, metadata_list, "numDocsMatched", ""+hits.size()); 
     223        GSXML.addMetadata(metadata_list, "numDocsMatched", ""+hits.size()); 
    223224 
    224225        System.err.println(hits.getNumFound() + " documents found, " 
     
    229230 
    230231            String node_id = (String)solr_doc.get("docOID"); 
    231             Element node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 
     232            Element node = result_doc.createElement(GSXML.DOC_NODE_ELEM); 
    232233            node.setAttribute(GSXML.NODE_ID_ATT, node_id); 
    233234            doc_node_list.appendChild(node);