Share via


JoinSpec Class

Definition

This class represents the specifications for the joining operation in search.

[Android.Runtime.Register("android/app/appsearch/JoinSpec", ApiSince=34, DoNotGenerateAcw=true)]
public sealed class JoinSpec : Java.Lang.Object
[Android.Runtime.Register("android/app/appsearch/JoinSpec", ApiSince=34, DoNotGenerateAcw=true)]
public sealed class JoinSpec : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/appsearch/JoinSpec", ApiSince=34, DoNotGenerateAcw=true)>]
type JoinSpec = class
    inherit Object
[<Android.Runtime.Register("android/app/appsearch/JoinSpec", ApiSince=34, DoNotGenerateAcw=true)>]
type JoinSpec = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
JoinSpec
Attributes
Implements

Remarks

This class represents the specifications for the joining operation in search.

Joins are only possible for matching on the qualified id of an outer document and a property value within a subquery document. In the subquery documents, these values may be referred to with a property path such as "email.recipient.id" or "entityId" or a property expression. One such property expression is "this.qualifiedId()", which refers to the document's combined package, database, namespace, and id.

Note that in order for perform the join, the property referred to by #getChildPropertyExpression has to be a property with AppSearchSchema.StringPropertyConfig#getJoinableValueType set to AppSearchSchema.StringPropertyConfig#JOINABLE_VALUE_TYPE_QUALIFIED_ID. Otherwise no documents will be joined to any SearchResult.

Take these outer query and subquery results for example:

{@code
            Outer result {
              id: id1
              score: 5
            }
            Subquery result 1 {
              id: id2
              score: 2
              entityId: pkg$db/ns#id1
              notes: This is some doc
            }
            Subquery result 2 {
              id: id3
              score: 3
              entityId: pkg$db/ns#id2
              notes: This is another doc
            }
            }

In this example, subquery result 1 contains a property "entityId" whose value is "pkg$db/ns#id1", referring to the outer result. If you call Builder with "entityId", we will retrieve the value of the property "entityId" from the child document, which is "pkg$db#ns/id1". Let's say the qualified id of the outer result is "pkg$db#ns/id1". This would mean the subquery result 1 document will be matched to that parent document. This is done by adding a SearchResult containing the child document to the top-level parent SearchResult#getJoinedResults.

If #getChildPropertyExpression is "notes", we will check the values of the notes property in the subquery results. In subquery result 1, this values is "This is some doc", which does not equal the qualified id of the outer query result. As such, subquery result 1 will not be joined to the outer query result.

It's possible to define an advanced ranking strategy in the nested SearchSpec and also use SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE in the outer SearchSpec. In this case, the parents will be ranked based on an aggregation, such as the sum, of the signals calculated by scoring the joined documents with the advanced ranking strategy.

In terms of scoring, if SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE is set in SearchSpec#getRankingStrategy, the scores of the outer SearchResults can be influenced by the ranking signals of the subquery results. For example, if the JoinSpec#getAggregationScoringStrategy is set to:

<ul> <li>JoinSpec#AGGREGATION_SCORING_MIN_RANKING_SIGNAL, the ranking signal of the outer SearchResult will be set to the minimum of the ranking signals of the subquery results. In this case, it will be the minimum of 2 and 3, which is 2. <li>JoinSpec#AGGREGATION_SCORING_MAX_RANKING_SIGNAL, the ranking signal of the outer SearchResult will be 3. <li>JoinSpec#AGGREGATION_SCORING_AVG_RANKING_SIGNAL, the ranking signal of the outer SearchResult will be 2.5. <li>JoinSpec#AGGREGATION_SCORING_RESULT_COUNT, the ranking signal of the outer SearchResult will be 2 as there are two joined results. <li>JoinSpec#AGGREGATION_SCORING_SUM_RANKING_SIGNAL, the ranking signal of the outer SearchResult will be 5, the sum of 2 and 3. <li>JoinSpec#AGGREGATION_SCORING_OUTER_RESULT_RANKING_SIGNAL, the ranking signal of the outer SearchResult will stay as it is. </ul>

Referring to "this.childrenRankingSignals()" in the ranking signal of the outer query will return the signals calculated by scoring the joined documents using the scoring strategy in the nested SearchSpec, as in SearchResult#getRankingSignal.

Java documentation for android.app.appsearch.JoinSpec.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

AggregationScoringAvgRankingSignal
Obsolete.

Score the aggregation of joined documents using the average ranking signal.

AggregationScoringMaxRankingSignal
Obsolete.

Score the aggregation of joined documents using the largest ranking signal.

AggregationScoringMinRankingSignal
Obsolete.

Score the aggregation of joined documents using the smallest ranking signal.

AggregationScoringOuterResultRankingSignal
Obsolete.

Do not score the aggregation of joined documents.

AggregationScoringResultCount
Obsolete.

Score the aggregation of joined documents by counting the number of results.

AggregationScoringSumRankingSignal
Obsolete.

Score the aggregation of joined documents using the sum of ranking signal.

Properties

AggregationScoringStrategy

Gets the joined document list scoring strategy.

ChildPropertyExpression

The property expression that is used to get values from child documents, returned from the nested search.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MaxJoinedResultCount

Returns the max amount of SearchResult objects to return with the parent document, with a default of 10 SearchResults.

NestedQuery

Returns the query to run on the joined documents.

NestedSearchSpec

Returns the search spec used to retrieve the joined documents.

PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to