Language

SearchSpec.Builder.SetMaxSnippetSize(Int32) Method

Definition

Sets maxSnippetSize, the maximum snippet size.

[Android.Runtime.Register("setMaxSnippetSize", "(I)Landroid/app/appsearch/SearchSpec$Builder;", "", ApiSince=31)]
public Android.App.AppSearch.SearchSpec.Builder SetMaxSnippetSize(int maxSnippetSize);
[<Android.Runtime.Register("setMaxSnippetSize", "(I)Landroid/app/appsearch/SearchSpec$Builder;", "", ApiSince=31)>]
member this.SetMaxSnippetSize : int -> Android.App.AppSearch.SearchSpec.Builder

Parameters

maxSnippetSize
Int32

Value is between 0 and ERROR(/android.app.appsearch.SearchSpec#MAX_SNIPPET_SIZE_LIMIT) inclusive

Returns

Attributes

Remarks

Sets maxSnippetSize, the maximum snippet size. Snippet windows start at maxSnippetSize/2 bytes before the middle of the matching token and end at maxSnippetSize/2 bytes after the middle of the matching token. It respects token boundaries, therefore the returned window may be smaller than requested. Setting maxSnippetSize to 0 will disable windowing and an empty String will be returned. If matches enabled is also set to false, then snippeting is disabled. For example, maxSnippetSize = 16. "foo bar baz bat rat" with a query of "baz" will return a window of "bar baz bat" which is only 11 bytes long.

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

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