public interface

LimitConfig

 androidx.appsearch.localstorage.LimitConfig

Subclasses:

UnlimitedLimitConfig, AppSearchConfig, AppSearchConfigImpl

Gradle dependencies

compile group: 'androidx.appsearch', name: 'appsearch-local-storage', version: '1.1.0-alpha05'

  • groupId: androidx.appsearch
  • artifactId: appsearch-local-storage
  • version: 1.1.0-alpha05

Artifact androidx.appsearch:appsearch-local-storage:1.1.0-alpha05 it located at Google repository (https://maven.google.com/)

Overview

Defines limits placed on users of AppSearch and enforced by AppSearchImpl.

Summary

Methods
public intgetMaxDocumentCount()

The maximum number of documents a single app is allowed to index.

public intgetMaxDocumentSizeBytes()

The maximum number of bytes a single document is allowed to be.

public intgetMaxSuggestionCount()

The maximum number of suggestion results a single app is allowed to search.

Methods

public int getMaxDocumentSizeBytes()

The maximum number of bytes a single document is allowed to be.

Enforced at the time of serializing the document into a proto.

This limit has two purposes:

  1. Prevent the system service from using too much memory during indexing or querying by capping the size of the data structures it needs to buffer
  2. Prevent apps from using a very large amount of data by storing exceptionally large documents.

public int getMaxDocumentCount()

The maximum number of documents a single app is allowed to index.

Enforced at indexing time.

This limit has two purposes:

  1. Protect icing lib's docid space from being overwhelmed by a single app. The overall docid limit is currently 2^20 (~1 million)
  2. Prevent apps from using a very large amount of data on the system by storing too many documents.

public int getMaxSuggestionCount()

The maximum number of suggestion results a single app is allowed to search.

Enforced at searching suggestion time.

The purpose of this limit is to protect Android framework system resource like memory from being overwhelmed by a single app.

Source

/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.appsearch.localstorage;

import androidx.annotation.RestrictTo;

/**
 * Defines limits placed on users of AppSearch and enforced by {@link AppSearchImpl}.
 * @exportToFramework:hide
 */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public interface LimitConfig {
    /**
     * The maximum number of bytes a single document is allowed to be.
     *
     * <p>Enforced at the time of serializing the document into a proto.
     *
     * <p>This limit has two purposes:
     * <ol>
     *     <li>Prevent the system service from using too much memory during indexing or querying
     *     by capping the size of the data structures it needs to buffer
     *     <li>Prevent apps from using a very large amount of data by storing exceptionally large
     *     documents.
     * </ol>
     */
    int getMaxDocumentSizeBytes();

    /**
     * The maximum number of documents a single app is allowed to index.
     *
     * <p>Enforced at indexing time.
     *
     * <p>This limit has two purposes:
     * <ol>
     *     <li>Protect icing lib's docid space from being overwhelmed by a single app. The
     *     overall docid limit is currently 2^20 (~1 million)
     *     <li>Prevent apps from using a very large amount of data on the system by storing too many
     *     documents.
     * </ol>
     */
    int getMaxDocumentCount();

    /**
     * The maximum number of suggestion results a single app is allowed to search.
     *
     * <p>Enforced at searching suggestion time.
     *
     * <p>The purpose of this limit is to protect Android framework system resource like memory
     * from being overwhelmed by a single app.
     */
    int getMaxSuggestionCount();
}