All Products
Search
Document Center

OpenSearch:Query results in the XML format

Last Updated:Feb 28, 2024

OpenSearch Retrieval Engine Edition supports the following types of queries: standard queries, independent phase-1 queries, and independent phase-2 queries. This topic describes the query results of these types of queries.

Results of standard queries

<?xml version="1.0" encoding="UTF-8"?>
<Root>
<TotalTime>0.003</TotalTime>
<SortExprMeta>< ![CDATA[-RANK]] ></SortExprMeta>                     ---0
<hits numhits="1" totalhits="8" coveredPercent="100.00">             ---1
	<hit cluster_name="simple4" hash_id="0" docid="15">          ---2
		<fields></fields>                                    ---3
		<property></property>                                ---4
		<attribute></attribute>                              ---5
		<variableValue></variableValue>                      ---6
		<sortExprValues>0.25</sortExprValues>                ---7
		<trace_info></trace_info>                            ---8
	</hit>                                                        
	<metaHit metaHitKey=""></metaHit>                            ---9
</hits>
<AggregateResults>                                                   ---10
	<AggregateResult key='company_id'>
	</AggregateResult>
</AggregateResults>
<Error>                                                              ---11
	<ErrorCode>0</ErrorCode>
	<ErrorDescription></ErrorDescription>
</Error>
<Request_Trace>                                                      ---12
</Request_Trace>
<fromCache></fromCache>                                              ---13
</Root>

<0> The names of the sorted fields and the sorting method. The minus sign (-) indicates that the fields are in descending order, and the plus sign (+) indicates that the fields are in ascending order.

<1> The coveredPercent parameter indicates the percentage of the partitions that are scanned in the first phase of the query.

<2> The information such as cluster name, hash ID, and document ID.

<3> The fields in the summary.

<4> The document information that you specified in the Query Result Searcher (QRS) plug-in.

<5> The values of the attribute fields that you specified in the query statement.

<6> Other information that you specified in the query statement.

Note: If you call the declareVariable method and specify the data that you want to serialize, the specified data is included in the query result.

<7> The value that is obtained based on the sort expression.

<8> The trace of the sorting operation. The trace records information in the logs that are collected during the process of calculating scores for documents. You can include the rank_trace parameter in the config clause of the query statement to specify a tracing level. The following output shows a sample trace:

  [TRACE1] [build/debug64/ha3/rank/DefaultScorer.cpp:53] tf=1

<9> The data that you specified to be returned by the QRS plug-in.

<10> The statistics.

If you use the aggregate=group_key:company_id,agg_fun:max(id)#min(id) clause in a query statement, the following result is returned:

 <AggregateResults>
        <AggregateResult key='company_id'>
                <group value='1'><max>1</max><min>0</min></group>
                <group value='2'><max>3</max><min>1</min></group>
        </AggregateResult>
</AggregateResults>

<11> The error information, including the ParitionId, HostName, ErrorCode, and ErrorDescription parameters.

<12> The trace of the request. The trace describes information about the query process, including the query phases and the period of time that is required for each query phase. You can specify the tracing level in the config clause.

<13> Indicates whether the query result is retrieved from the QRS cache. This parameter is returned only when the value of the cache_info parameter in the config clause is yes.

Results of independent phrase-1 queries

<?xml version="1.0" encoding="UTF-8"?>
<Root>
<TotalTime>0.002</TotalTime>
<SortExprMeta>< ![CDATA[-RANK]] ></SortExprMeta>
<hits numhits="1" totalhits="8" coveredPercent="100.00">
	<hit cluster_name="simple4" hash_id="0" docid="15" gid="simple4_0_0_0_15" pk="00000000000000004d8a42e58ec9d95d">
		<fields>
		</fields>
		<property>
		</property>
		<attribute>
		</attribute>
		<sortExprValues>0.25</sortExprValues>
		<trace_info>
		</trace_info>
	</hit>
</hits>
<AggregateResults>
</AggregateResults>
<Error>
	<ErrorCode>0</ErrorCode>
	<ErrorDescription></ErrorDescription>
</Error>
<Request_Trace>
</Request_Trace>
</Root>

Compared with results of standard queries, the hit parameter in results of independent phrase-1 queries contains the gid and pk components, and the value of the fields parameter is empty. The pk parameter is returned only if you specified the primary key of the corresponding document in the query statement.

Results of independent phrase-2 queries

Compared with results of standard queries, the hit parameter in results of independent phrase-2 queries contains the gid component, and the returned values of the totalhits parameter and coveredPercent parameter are 0.