public final class JoinUtil extends Object
|Modifier and Type||Method and Description|
Method for query time joining.
public static Query createJoinQuery(String fromField, boolean multipleValuesPerDocument, String toField, Query fromQuery, IndexSearcher fromSearcher, ScoreMode scoreMode) throws IOException
IndexSearcherto retrieve all documents that have the same terms in the to field that match with documents matching the specified fromQuery and have the same terms in the from field. In the case a single document relates to more than one document the
multipleValuesPerDocumentoption should be set to true. When the
multipleValuesPerDocumentis set to
trueonly the the score from the first encountered join value originating from the 'from' side is mapped into the 'to' side. Even in the case when a second join value related to a specific document yields a higher score. Obviously this doesn't apply in the case that
ScoreMode.Noneis used, since no scores are computed at all. Memory considerations: During joining all unique join values are kept in memory. On top of that when the scoreMode isn't set to
ScoreMode.Nonea float value per unique join value is kept in memory for computing scores. When scoreMode is set to
ScoreMode.Avgalso an additional integer value is kept in memory per unique join value.
fromField- The from field to join from
multipleValuesPerDocument- Whether the from field has multiple terms per document
toField- The to field to join to
fromQuery- The query to match documents on the from side
fromSearcher- The searcher that executed the specified fromQuery
scoreMode- Instructs how scores from the fromQuery are mapped to the returned query
Queryinstance that can be used to join documents based on the terms in the from and to field
IOException- If I/O related errors occur
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.