org.apache.solr.search.join

## Class ScoreJoinQParserPlugin

- java.lang.Object
- - org.apache.solr.search.QParserPlugin
  - - org.apache.solr.search.join.ScoreJoinQParserPlugin

- All Implemented Interfaces:
    SolrInfoMBean, NamedListInitializedPlugin

      public class ScoreJoinQParserPlugin
      extends QParserPlugin

  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`
  - 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,min`. Capital case is also accepted.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean

      `SolrInfoMBean.Category`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `SCORE`

    - ### Fields inherited from class org.apache.solr.search.QParserPlugin

      `DEFAULT_QTYPE, standardPlugins`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScoreJoinQParserPlugin()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `QParser` | `createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req)` return a `QParser`
    `static String` | `getCoreName(String fromIndex, CoreContainer container)` Returns an String with the name of a core.

    - ### Methods inherited from class org.apache.solr.search.QParserPlugin

      `getCategory, getDescription, getDocs, getName, getSource, getStatistics, getVersion, init`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SCORE

          public static final String SCORE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ScoreJoinQParserPlugin

          public ScoreJoinQParserPlugin()

  - ### Method Detail

    - #### createParser

          public QParser createParser(String qstr,
                                      SolrParams localParams,
                                      SolrParams params,
                                      SolrQueryRequest req)

      Description copied from class: `QParserPlugin`
      return a `QParser`
      Specified by:
        `createParser` in class `QParserPlugin`

    - #### getCoreName

          public static String getCoreName(String fromIndex,
                                           CoreContainer container)

      Returns an String with the name of a core.

      This method searches the core with fromIndex name in the core's container. If fromIndex isn't name of collection or alias it's returns fromIndex without changes. If fromIndex is name of alias but if the alias points to multiple collections it's throw SolrException.ErrorCode.BAD_REQUEST because multiple shards not yet supported.

      Parameters:
        `fromIndex` - name of the index
        `container` - the core container for searching the core with fromIndex name or alias
      Returns:
        the string with name of core

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.