Språk

SearchSpec.Builder.AddProjectionPaths Method

Definition

Sets the projection paths for the specified schema type.

[Android.Runtime.Register("addProjectionPaths", "(Ljava/lang/String;Ljava/util/Collection;)Landroid/app/appsearch/SearchSpec$Builder;", "", ApiSince=34)]
public Android.App.AppSearch.SearchSpec.Builder AddProjectionPaths(string schema, System.Collections.Generic.ICollection<Android.App.AppSearch.PropertyPath> propertyPaths);
[<Android.Runtime.Register("addProjectionPaths", "(Ljava/lang/String;Ljava/util/Collection;)Landroid/app/appsearch/SearchSpec$Builder;", "", ApiSince=34)>]
member this.AddProjectionPaths : string * System.Collections.Generic.ICollection<Android.App.AppSearch.PropertyPath> -> Android.App.AppSearch.SearchSpec.Builder

Parameters

schema
String

The schema type name, or * for types without their own projection. This value cannot be null.

propertyPaths
ICollection<PropertyPath>

The property paths to retrieve. Neither the collection nor its entries can be null.

Returns

This builder instance.

Attributes

Remarks

Sets the projection paths for the specified schema type. A later call for the same type replaces its previous paths. Only the specified properties are retrieved for results of that type. If a specified property path isn't present in a result, it is ignored for that result. Property paths cannot be null. If neither a type-specific projection nor a wildcard projection is set, all properties of results of that type are retrieved. Paths set for * apply to results whose types do not have their own paths set.

Suppose the following document is in the index.

Email: Document {
  sender: Document {
    name: "Mr. Person"
    email: "mrperson123@google.com"
  }
  recipients: [
    Document {
      name: "John Doe"
      email: "johndoe123@google.com"
    }
    Document {
      name: "Jane Doe"
      email: "janedoe123@google.com"
    }
  ]
  subject: "IMPORTANT"
  body: "Limited time offer!"
}

Then, suppose that a query for "important" is issued with the following projection type property paths:

{schema: "Email", ["subject", "sender.name", "recipients.name"]}

The above document will be returned as:

Email: Document {
  sender: Document {
    name: "Mr. Person"
  }
  recipients: [
    Document {
      name: "John Doe"
    }
    Document {
      name: "Jane Doe"
    }
  ]
  subject: "IMPORTANT"
}

Android reference for android.app.appsearch.SearchSpec.Builder.addProjectionPaths.

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.

Applies to