Beispiel #1
0
  def run_query(self, result, index, app_id, namespace, search_params):
    """ Creates a SOLR query string and runs it on SOLR. 

    Args:
      result: A search_service_pb.SearchResponse.
      index: Index for which we're running the query.
      app_id: A str, the application identifier.
      namespace: A str, the namespace.
      search_params: A search_service_pb.SearchParams.
    """
    query = search_params.query()
    field_spec = search_params.field_spec()
    sort_list = search_params.sort_spec_list()
    parser = query_parser.SolrQueryParser(index, app_id, namespace,
      field_spec, sort_list, search_params.limit(),
      search_params.offset())
    solr_query = parser.get_solr_query_string(query)
    logging.debug("Solr query: {0}".format(solr_query))
    solr_results = self.__execute_query(solr_query)
    logging.debug("Solr results: {0}".format(solr_results))
    self.__convert_to_gae_results(result, solr_results, index)
    logging.debug("GAE results: {0}".format(result))
 def test_constructor(self):
     query_parser.SolrQueryParser("what", "appid", "namespace",
                                  'field_spec', 'sort_spec', 'limit',
                                  'offset')