Changeset 3753

Show
Ignore:
Timestamp:
21.02.2003 11:42:07 (17 years ago)
Author:
mdewsnip
Message:

Added support for query results metadata: number of matching documents, and query term information.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java

    r3682 r3753  
    146146         
    147147    Element mr_query_response = (Element)mr_.process(mr_query_message); 
    148          
     148    // System.out.println("Query response: " + converter_.getString(mr_query_response)); 
     149 
     150    Element query_result_metadata_list = (Element) GSXML.getNodeByPath(mr_query_response, "response/content/metadataList"); 
     151    if (query_result_metadata_list == null) { 
     152        System.err.println("Warning: No query result metadata.\n"); 
     153    } 
     154    else { 
     155        System.out.println("Query result metadata: " + converter_.getString(query_result_metadata_list) + "\n"); 
     156    } 
     157 
    149158    // this result is the list of docs. 
    150159    // now take that list, and get the Titles 
     
    194203    meta_content.appendChild(metadata_list); 
    195204     
     205    // System.out.println("Metadata message: " + converter_.getString(mr_metadata_message)); 
    196206    Element mr_metadata_response = (Element)mr_.process(mr_metadata_message); 
    197207     
    198208    Element result_response = (Element)GSXML.getChildByTagName(mr_metadata_response, GSXML.RESPONSE_ELEM); 
    199209     
     210    // If there is some metadata about the query results, add it in 
     211    if (query_result_metadata_list != null) { 
     212        Element result_content = (Element) GSXML.getChildByTagName(result_response, 
     213                                       GSXML.CONTENT_ELEM); 
     214        result_content.appendChild(query_result_metadata_list); 
     215    } 
     216 
    200217    page.appendChild(doc_.importNode(result_response, true)); 
    201218     
     219    // System.out.println("XMLTransformer input: " + converter_.getString(page)); 
    202220     
    203221    // output the page 
     
    205223    Document style_doc = converter_.getDOM(new File(stylesheet)); 
    206224    GSXSLT.absoluteIncludePaths(style_doc, config_); 
    207     return (Element)transformer_.transform(style_doc, page);     
     225    // Node temp = transformer_.transform(style_doc, page); 
     226        // System.out.println("XMLTransformer output: " + converter_.getString(temp)); 
     227    // return (Element) temp; 
     228    return (Element)transformer_.transform(style_doc, page); 
    208229     
    209230    }