JoinSpec.Builder
public
static
final
class
JoinSpec.Builder
extends Object
java.lang.Object | |
↳ | android.app.appsearch.JoinSpec.Builder |
Builder for objects
.
Summary
Public constructors | |
---|---|
Builder(String childPropertyExpression)
Create a specification for the joining operation in search. |
Public methods | |
---|---|
JoinSpec
|
build()
Constructs a new |
JoinSpec.Builder
|
setAggregationScoringStrategy(int aggregationScoringStrategy)
Sets how we derive a single score from a list of joined documents. |
JoinSpec.Builder
|
setMaxJoinedResultCount(int maxJoinedResultCount)
Sets the max amount of |
JoinSpec.Builder
|
setNestedSearch(String nestedQuery, SearchSpec nestedSearchSpec)
Sets the query and the SearchSpec for the documents being joined. |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (String childPropertyExpression)
Create a specification for the joining operation in search.
The child property expression 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 |
String : the property to match in the child documents.
This value cannot be null . |
Public methods
build
public JoinSpec build ()
Constructs a new JoinSpec
from the contents of this builder.
Returns | |
---|---|
JoinSpec |
This value cannot be null . |
setAggregationScoringStrategy
public JoinSpec.Builder setAggregationScoringStrategy (int aggregationScoringStrategy)
Sets how we derive a single score from a list of joined documents.
The default scoring strategy is JoinSpec.AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL
, which specifies that the ranking
signal of the outer parent document will be used.
Returns | |
---|---|
JoinSpec.Builder |
This value cannot be null . |
setMaxJoinedResultCount
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.
Parameters | |
---|---|
maxJoinedResultCount |
int |
Returns | |
---|---|
JoinSpec.Builder |
This value cannot be null . |
setNestedSearch
public JoinSpec.Builder setNestedSearch (String nestedQuery, SearchSpec nestedSearchSpec)
Sets the query and the SearchSpec for the documents being joined. This will score and rank the joined documents as well as filter the joined documents.
If SearchSpec.RANKING_STRATEGY_JOIN_AGGREGATE_SCORE
is set in the outer SearchSpec
, the resulting signals will be used to rank the parent documents. Note that
the aggregation strategy also needs to be set with setAggregationScoringStrategy(int)
, otherwise the default will be JoinSpec.AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL
, which will just use the parent
documents ranking signal.
If this method is never called, JoinSpec.getNestedQuery
will return an empty
string, meaning we will join with every possible document that matches the equality
constraints and hasn't been filtered out by the type or namespace filters.
Parameters | |
---|---|
nestedQuery |
String : This value cannot be null . |
nestedSearchSpec |
SearchSpec : This value cannot be null . |
Returns | |
---|---|
JoinSpec.Builder |
This value cannot be null . |