Create a query-time join query with scoring.
It just calls
JoinUtil.createJoinQuery(String, boolean, String, Query, org.apache.lucene.search.IndexSearcher, ScoreMode)
.
It runs subordinate query and collects values of "from" field and scores, then it lookups these collected values in "to" field, and
yields aggregated scores.
Local parameters are similar to
JoinQParserPlugin
{!join}
This plugin doesn't have own name, and is called by specifying local parameter
{!join score=...}...
.
Note: this parser is invoked even if you specify
score=none
.
Example:
q={!join from=manu_id_s to=id score=total}foo
- from - "foreign key" field name to collect values while enumerating subordinate query (denoted as
foo
in example above).
it's better to have this field declared as type="string" docValues="true"
.
note: if docValues are not enabled for this field, it will work anyway,
but it costs some memory for UninvertingReader
.
Also, numeric doc values are not supported until LUCENE-5868.
Thus, it only supports DocValuesType.SORTED
, DocValuesType.SORTED_SET
, DocValuesType.BINARY
.
- fromIndex - optional parameter, a core name where subordinate query should run (and
from
values are collected) rather than current core.
Example:q={!join from=manu_id_s to=id score=total fromIndex=products}foo
Follow up SOLR-7775 for SolrCloud collections support.
- to - "primary key" field name which is searched for values collected from subordinate query.
it should be declared as
indexed="true"
. Now it's treated as a single value field.
- score - one of
ScoreMode
: None,Avg,Total,Max. Lowercase is also accepted.