JoinSpec.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Builder
( String
childPropertyExpression) Create a specification for the joining operation in search.
Inherited Method Summary
From class java.lang.Object
Public Constructors
public
Builder
( String
childPropertyExpression)
Create a specification for the joining operation in search.
The child property expressions Specifies how to join documents. Documents with a
child property expression equal to the qualified id of the parent will be
retrieved.
Property expressions differ from PropertyPath
as property expressions may refer to document properties or nested document properties
such as "person.business.id" as well as a property expression. Currently the only
property expression is "this.qualifiedId()". PropertyPath
objects may only reference document properties and nested document properties.
In order to join a child document to a parent document, the child document must
contain the parent's qualified id at the property expression specified by this
method.
Parameters
childPropertyExpression
the property to match in the child documents.
Public Methods
Constructs a new JoinSpec
from the contents of this builder.
public JoinSpec.Builder
setAggregationScoringStrategy
(int aggregationScoringStrategy)
public JoinSpec.Builder
setMaxJoinedResultCount
(int maxJoinedResultCount)
Sets the max amount of SearchResults
to return with the parent document, with a default of 10 SearchResults.
This does NOT limit the number of results that are joined with the parent document
for scoring. This means that, when set, only a maximum of maxJoinedResultCount
results will be returned with each parent document,
but all results that are joined with a parent will factor into the score.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eJoinSpec.Builder\u003c/code\u003e facilitates creating JoinSpec objects for joining operations in AppSearch.\u003c/p\u003e\n"],["\u003cp\u003eIt allows specifying how documents are joined using a child property expression that matches the parent's qualified ID.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize the join operation by setting the aggregation scoring strategy, maximum joined results, and nested search criteria.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eJoinSpec.Builder\u003c/code\u003e provides methods like \u003ccode\u003ebuild()\u003c/code\u003e, \u003ccode\u003esetAggregationScoringStrategy()\u003c/code\u003e, \u003ccode\u003esetMaxJoinedResultCount()\u003c/code\u003e, and \u003ccode\u003esetNestedSearch()\u003c/code\u003e for configuration.\u003c/p\u003e\n"],["\u003cp\u003eBy default, it joins with all matching documents and uses the parent's ranking signal for scoring unless otherwise specified.\u003c/p\u003e\n"]]],["The `JoinSpec.Builder` class facilitates the creation of join operations in searches. Key actions include: using `Builder(String childPropertyExpression)` to specify how documents are joined. `build()` constructs the `JoinSpec` object. `setAggregationScoringStrategy(int)` determines how scores from joined documents are combined. `setMaxJoinedResultCount(int)` limits the number of `SearchResults` returned per parent document. `setNestedSearch(String, SearchSpec)` defines the query and search specifications for joined documents.\n"],null,["# JoinSpec.Builder\n\npublic static final class **JoinSpec.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder for [objects](/android/reference/com/google/android/gms/appsearch/JoinSpec). \n\n### Public Constructor Summary\n\n|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder#Builder(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) childPropertyExpression) Create a specification for the joining operation in search. |\n\n### Public Method Summary\n\n|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [JoinSpec](/android/reference/com/google/android/gms/appsearch/JoinSpec) | [build](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder#build())() Constructs a new [JoinSpec](/android/reference/com/google/android/gms/appsearch/JoinSpec) from the contents of this builder. |\n| [JoinSpec.Builder](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder) | [setAggregationScoringStrategy](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder#setAggregationScoringStrategy(int))(int aggregationScoringStrategy) Sets how we derive a single score from a list of joined documents. |\n| [JoinSpec.Builder](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder) | [setMaxJoinedResultCount](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder#setMaxJoinedResultCount(int))(int maxJoinedResultCount) Sets the max amount of [SearchResults](/android/reference/com/google/android/gms/appsearch/SearchResults) to return with the parent document, with a default of 10 SearchResults. |\n| [JoinSpec.Builder](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder) | [setNestedSearch](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder#setNestedSearch(java.lang.String,%20com.google.android.gms.appsearch.SearchSpec))([String](//developer.android.com/reference/java/lang/String.html) nestedQuery, [SearchSpec](/android/reference/com/google/android/gms/appsearch/SearchSpec) nestedSearchSpec) Sets the query and the SearchSpec for the documents being joined. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** ([String](//developer.android.com/reference/java/lang/String.html) childPropertyExpression)\n\nCreate a specification for the joining operation in search.\n\nThe child property expressions Specifies how to join documents. Documents with a\nchild property expression equal to the qualified id of the parent will be\nretrieved.\n\nProperty expressions differ from [PropertyPath](/android/reference/com/google/android/gms/appsearch/PropertyPath)\nas property expressions may refer to document properties or nested document properties\nsuch as \"person.business.id\" as well as a property expression. Currently the only\nproperty expression is \"this.qualifiedId()\". [PropertyPath](/android/reference/com/google/android/gms/appsearch/PropertyPath)\nobjects may only reference document properties and nested document properties.\n\nIn order to join a child document to a parent document, the child document must\ncontain the parent's qualified id at the property expression specified by this\nmethod. \n\n##### Parameters\n\n| childPropertyExpression | the property to match in the child documents. |\n|-------------------------|-----------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [JoinSpec](/android/reference/com/google/android/gms/appsearch/JoinSpec)\n**build** ()\n\nConstructs a new [JoinSpec](/android/reference/com/google/android/gms/appsearch/JoinSpec)\nfrom the contents of this builder. \n\n#### public [JoinSpec.Builder](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder)\n**setAggregationScoringStrategy** (int aggregationScoringStrategy)\n\nSets how we derive a single score from a list of joined documents.\n\nThe default scoring strategy is [JoinSpec.AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL](/android/reference/com/google/android/gms/appsearch/JoinSpec#AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL), which specifies\nthat the ranking signal of the outer parent document will be used. \n\n##### See Also\n\n- [SearchSpec.RANKING_STRATEGY_JOIN_AGGREGATE_SCORE](/android/reference/com/google/android/gms/appsearch/SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE) \n\n#### public [JoinSpec.Builder](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder)\n**setMaxJoinedResultCount** (int maxJoinedResultCount)\n\nSets the max amount of [SearchResults](/android/reference/com/google/android/gms/appsearch/SearchResults)\nto return with the parent document, with a default of 10 SearchResults.\n\nThis does NOT limit the number of results that are joined with the parent document\nfor scoring. This means that, when set, only a maximum of\n`maxJoinedResultCount` results will be returned with each parent document,\nbut all results that are joined with a parent will factor into the score. \n\n#### public [JoinSpec.Builder](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder)\n**setNestedSearch** ([String](//developer.android.com/reference/java/lang/String.html) nestedQuery, [SearchSpec](/android/reference/com/google/android/gms/appsearch/SearchSpec) nestedSearchSpec)\n\nSets the query and the SearchSpec for the documents being joined. This will score\nand rank the joined documents as well as filter the joined documents.\n\nIf [SearchSpec.RANKING_STRATEGY_JOIN_AGGREGATE_SCORE](/android/reference/com/google/android/gms/appsearch/SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE) is set in the outer\n[SearchSpec](/android/reference/com/google/android/gms/appsearch/SearchSpec),\nthe resulting signals will be used to rank the parent documents. Note that the\naggregation strategy also needs to be set with [setAggregationScoringStrategy(int)](/android/reference/com/google/android/gms/appsearch/JoinSpec.Builder#setAggregationScoringStrategy(int)), otherwise the default will be\n[JoinSpec.AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL](/android/reference/com/google/android/gms/appsearch/JoinSpec#AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL), which will just\nuse the parent documents ranking signal.\n\nIf this method is never called, [JoinSpec.getNestedQuery()](/android/reference/com/google/android/gms/appsearch/JoinSpec#getNestedQuery())\nwill return an empty string, meaning we will join with every possible document that\nmatches the equality constraints and hasn't been filtered out by the type or namespace\nfilters. \n\n##### See Also\n\n- [JoinSpec.getNestedQuery()](/android/reference/com/google/android/gms/appsearch/JoinSpec#getNestedQuery())\n- [JoinSpec.getNestedSearchSpec()](/android/reference/com/google/android/gms/appsearch/JoinSpec#getNestedSearchSpec())"]]