Fusion Query Request Objects

A Fusion Query Request organizes the contents of each query submitted to a Fusion query pipeline. A Request object is comprised of the HTTP method, a set of HTTP headers, and a set of query parameters.

The Request Java API

Under the Fusion hood, a Request is a Java object. The link to the public API javadoc page is: Request

JSON representation of a Request object

The JSON representation of a Request object has three fields:

  • httpMethod: value is a string, one of the defined HTTP methods (verbs), usually GET.

  • headers : value is an object consisting of the set of defined header fields on the request.

  • params : value is an object consisting of the set of query parameter names and corresponding parameter values.

The httpMethod and headers reflect the initial pipeline request. The Fusion Request object public API doesn’t provide methods to update these fields.

The Fusion Request object public API provides methods to get and set the param fields and their values.

Query pipeline stages add, remove, and update the values in the params field. To see how the query parameters are affected by query pipeline stage, we insert a Logging Query stage at the very beginning of a Query Pipeline and capture the request object printed to the Fusion log file $Fusion/logs/api/api.log. The example query pipeline used here is called "medsamp-default." This pipeline is composed of the following sequence of stages:

  • Logging Query

  • Query Fields

  • Logging Query

  • Facet

  • Logging Query

  • Solr Query

Using the Admin Search tool, we submit the query "oxygen". The initial Logging Query stage shows the Request object. The "params" field takes an object consisting of a set of param names, param values. The param name "q" takes as its value the list of query terms, which in this case, is a list consisting of the word "oxygen":

{
  "headers" : {
    "Accept-Collections" : [ "*" ],
    "Fusion-User-Auth-Realm" : [ "native" ],
    "Host" : [ "172.16.2.12:8765" ],
    "Content-Length" : [ "0" ],
    "Fusion-Session-Id" : [ "e7085302-f5c5-4401-ba79-a4ead8a9f65a" ],
    "Accept-Encoding" : [ "gzip, deflate" ],
    "User-Agent" : [ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36" ],
    "Via" : [ "1.0 apollo-proxy" ],
    "Fusion-User-Role" : [ "admin" ],
    "Accept" : [ "application/json, text/plain, */*" ],
    "Content-Type" : [ "application/json; charset=UTF-8" ],
    "Fusion-User-Name" : [ "admin" ],
    "Fusion-User-Id" : [ "a4096f7e-2de8-4910-beb4-93f30a3a5eb6" ]
  },
  "params" : {
    "echoParams" : [ "all" ],
    "start" : [ "0" ],
    "lw.pipelineId" : [ "medsamp-default" ],
    "q" : [ "oxygen" ],
    "json.nl" : [ "arrarr" ],
    "wt" : [ "json" ]
  },
  "httpMethod" : "GET"
}

The Query Fields stage updates the Request object, and the second Logging Query stage reflects these changes. Here we have omitted the "headers", as they are unchanged (and unchangable). The Query Fields stage added params "fl" (fields list - document fields returned), "qf" (query fields - the fields used for search), and "defType" (the default scoring type) to the params set.

{
  "headers" : { ... }
  "params" : {
    "fl" : [ "article-title_txt", "article-vernacular-title_txt", "article-author-lastname_txt", "mesh-heading_ss", "pmid_txt", "article-language_s", "article-abstract_txt", "article-author-affiliation_txt" ],
    "echoParams" : [ "all" ],
    "start" : [ "0" ],
    "lw.pipelineId" : [ "medsamp-default" ],
    "q" : [ "oxygen" ],
    "qf" : [ "article-title_txt", "article-abstract_txt" ],
    "json.nl" : [ "arrarr" ],
    "wt" : [ "json" ],
    "rows" : [ "10" ],
    "defType" : [ "edismax" ]
  },
  "httpMethod" : "GET"
}

The Facets stage further updates the Request object, and the third Logging Query stage reflects these changes. The params set now includes param "facet".

 {
  "headers" : { ... }
  "params" : {
    "facet" : [ "true" ],
    "fl" : [ "article-title_txt", "article-vernacular-title_txt", "article-author-lastname_txt", "mesh-heading_ss", "pmid_txt", "article-language_s", "article-abstract_txt", "article-author-affiliation_txt" ],
    "echoParams" : [ "all" ],
    "start" : [ "0" ],
    "lw.pipelineId" : [ "medsamp-default" ],
    "q" : [ "oxygen" ],
    "qf" : [ "article-title_txt", "article-abstract_txt" ],
    "json.nl" : [ "arrarr" ],
    "wt" : [ "json" ],
    "rows" : [ "10" ],
    "defType" : [ "edismax" ]
  },
  "httpMethod" : "GET"
}