blob: b7100a478ad48138b791f9c3d33999fc4c288089 [file] [log] [blame]
Terry Wangfebbead2019-10-17 17:05:18 -07001/**
sidchhabraa7c8f8a2020-01-16 18:38:17 -08002 * Copyright 2020, The Android Open Source Project
Terry Wangfebbead2019-10-17 17:05:18 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.app.appsearch;
Alexander Dorokhinefd07eba2020-01-13 20:22:20 -080017
18import com.android.internal.infra.AndroidFuture;
19
Alexander Dorokhine969f4462020-03-05 15:54:19 -080020parcelable AppSearchResult;
Alexander Dorokhine18465842020-01-21 01:08:57 -080021parcelable AppSearchBatchResult;
22
Terry Wangfebbead2019-10-17 17:05:18 -070023/** {@hide} */
24interface IAppSearchManager {
Alexander Dorokhinefd07eba2020-01-13 20:22:20 -080025 /**
26 * Sets the schema.
27 *
Alexander Dorokhinecc223452020-01-19 03:00:28 -080028 * @param schemaBytes Serialized SchemaProto.
Alexander Dorokhine321e4b12020-01-18 11:15:00 -080029 * @param forceOverride Whether to apply the new schema even if it is incompatible. All
30 * incompatible documents will be deleted.
Alexander Dorokhine969f4462020-03-05 15:54:19 -080031 * @param callback {@link AndroidFuture}<{@link AppSearchResult}<{@link Void}&gt>.
32 * The results of the call.
Alexander Dorokhinefd07eba2020-01-13 20:22:20 -080033 */
Alexander Dorokhine969f4462020-03-05 15:54:19 -080034 void setSchema(
35 in byte[] schemaBytes, boolean forceOverride, in AndroidFuture<AppSearchResult> callback);
Alexander Dorokhinecc223452020-01-19 03:00:28 -080036
37 /**
Alexander Dorokhine18465842020-01-21 01:08:57 -080038 * Inserts documents into the index.
Alexander Dorokhinecc223452020-01-19 03:00:28 -080039 *
Alexander Dorokhine18465842020-01-21 01:08:57 -080040 * @param documentsBytes {@link List}&lt;byte[]&gt; of serialized DocumentProtos.
41 * @param callback
42 * {@link AndroidFuture}&lt;{@link AppSearchBatchResult}&lt;{@link String}, {@link Void}&gt;&gt;.
43 * If the call fails to start, {@code callback} will be completed exceptionally. Otherwise,
44 * {@code callback} will be completed with an
45 * {@link AppSearchBatchResult}&lt;{@link String}, {@link Void}&gt;
46 * where the keys are document URIs, and the values are {@code null}.
Alexander Dorokhinecc223452020-01-19 03:00:28 -080047 */
Alexander Dorokhine18465842020-01-21 01:08:57 -080048 void putDocuments(in List documentsBytes, in AndroidFuture<AppSearchBatchResult> callback);
Alexander Dorokhinecc223452020-01-19 03:00:28 -080049
sidchhabraa7c8f8a2020-01-16 18:38:17 -080050 /**
Alexander Dorokhine69a8d9f2020-03-06 10:43:16 -080051 * Retrieves documents from the index.
52 *
53 * @param uris The URIs of the documents to retrieve
Alexander Dorokhinea95f44f2020-03-06 13:53:14 -080054 * @param callback
55 * {@link AndroidFuture}&lt;{@link AppSearchBatchResult}&lt;{@link String}, {@link byte[]}&gt;&gt;.
56 * If the call fails to start, {@code callback} will be completed exceptionally. Otherwise,
57 * {@code callback} will be completed with an
58 * {@link AppSearchBatchResult}&lt;{@link String}, {@link byte[]}&gt;
59 * where the keys are document URIs, and the values are serialized Document protos.
Alexander Dorokhine69a8d9f2020-03-06 10:43:16 -080060 */
Alexander Dorokhinea95f44f2020-03-06 13:53:14 -080061 void getDocuments(in List<String> uris, in AndroidFuture<AppSearchBatchResult> callback);
Alexander Dorokhine69a8d9f2020-03-06 10:43:16 -080062
63 /**
sidchhabrab0098382020-01-22 11:47:22 -080064 * Searches a document based on a given specifications.
sidchhabraa7c8f8a2020-01-16 18:38:17 -080065 *
sidchhabrab0098382020-01-22 11:47:22 -080066 * @param searchSpecBytes Serialized SearchSpecProto.
67 * @param resultSpecBytes Serialized SearchResultsProto.
68 * @param scoringSpecBytes Serialized ScoringSpecProto.
Alexander Dorokhinee708e182020-03-06 15:30:34 -080069 * @param callback {@link AndroidFuture}&lt;{@link AppSearchResult}&lt;{@link byte[]}&gt;&gt;
70 * Will be completed with a serialized {@link SearchResultsProto}.
sidchhabraa7c8f8a2020-01-16 18:38:17 -080071 */
Alexander Dorokhinee708e182020-03-06 15:30:34 -080072 void query(
73 in byte[] searchSpecBytes, in byte[] resultSpecBytes, in byte[] scoringSpecBytes,
74 in AndroidFuture<AppSearchResult> callback);
Terry Wangfebbead2019-10-17 17:05:18 -070075}