Global Ordinals Join Query Parser
The globalOrdinalsJoin query parser allows joining documents within the same index using Lucene’s global ordinals (OrdinalMap).
It is backed by Lucene’s JoinUtil.createJoinQuery(joinField, fromQuery, toQuery, searcher, scoreMode, ordinalMap).
Global ordinals joins operate on a single shared field (joinField) that contains single-valued string docValues (StrField with docValues="true").
The query matches source documents using a "from" subquery, maps their join field ordinals across segments via global ordinals, and yields target documents matching the "to" subquery (specified by the which parameter).
Global ordinal mappings (OrdinalMap) are computed and cached per SolrIndexSearcher across search requests.
Parameters
This query parser accepts the following parameters:
joinField-
Required
Default: none
The name of the single-valued
StrFieldwithdocValues="true"used as the join key between documents. which-
Required
Default: none
A subquery specifying the target ("to") documents to join into. This parameter mimics the
whichparameter from the Block Join Query Parser. v-
Optional
Default: query body
The subquery specifying the source ("from") documents. If not provided as a local parameter, the body of the query is used.
score-
Optional
Default:
NoneControls how scores from matching "from" documents are aggregated and applied to matching "to" documents. Acceptable values (case-insensitive) are:
-
None: (default) No scores are transferred; matching target documents have a constant score. -
Avg: Average score of matching source documents. -
Max: Maximum score among matching source documents. -
Min: Minimum score among matching source documents. -
Total: Sum of scores across matching source documents.
-
Examples
Basic Global Ordinals Join
Find parent documents whose children match skill_s:java:
q={!globalOrdinalsJoin joinField=join_s_dv which="type_s:parent"}skill_s:java