Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 1 | /** |
sidchhabra | a7c8f8a | 2020-01-16 18:38:17 -0800 | [diff] [blame] | 2 | * Copyright 2020, The Android Open Source Project |
Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 3 | * |
| 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 | */ |
| 16 | package android.app.appsearch; |
Alexander Dorokhine | fd07eba | 2020-01-13 20:22:20 -0800 | [diff] [blame] | 17 | |
| 18 | import com.android.internal.infra.AndroidFuture; |
| 19 | |
Alexander Dorokhine | 969f446 | 2020-03-05 15:54:19 -0800 | [diff] [blame] | 20 | parcelable AppSearchResult; |
Alexander Dorokhine | 1846584 | 2020-01-21 01:08:57 -0800 | [diff] [blame] | 21 | parcelable AppSearchBatchResult; |
| 22 | |
Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 23 | /** {@hide} */ |
| 24 | interface IAppSearchManager { |
Alexander Dorokhine | fd07eba | 2020-01-13 20:22:20 -0800 | [diff] [blame] | 25 | /** |
| 26 | * Sets the schema. |
| 27 | * |
Alexander Dorokhine | cc22345 | 2020-01-19 03:00:28 -0800 | [diff] [blame] | 28 | * @param schemaBytes Serialized SchemaProto. |
Alexander Dorokhine | 321e4b1 | 2020-01-18 11:15:00 -0800 | [diff] [blame] | 29 | * @param forceOverride Whether to apply the new schema even if it is incompatible. All |
| 30 | * incompatible documents will be deleted. |
Alexander Dorokhine | 969f446 | 2020-03-05 15:54:19 -0800 | [diff] [blame] | 31 | * @param callback {@link AndroidFuture}<{@link AppSearchResult}<{@link Void}>>. |
| 32 | * The results of the call. |
Alexander Dorokhine | fd07eba | 2020-01-13 20:22:20 -0800 | [diff] [blame] | 33 | */ |
Alexander Dorokhine | 969f446 | 2020-03-05 15:54:19 -0800 | [diff] [blame] | 34 | void setSchema( |
| 35 | in byte[] schemaBytes, boolean forceOverride, in AndroidFuture<AppSearchResult> callback); |
Alexander Dorokhine | cc22345 | 2020-01-19 03:00:28 -0800 | [diff] [blame] | 36 | |
| 37 | /** |
Alexander Dorokhine | 1846584 | 2020-01-21 01:08:57 -0800 | [diff] [blame] | 38 | * Inserts documents into the index. |
Alexander Dorokhine | cc22345 | 2020-01-19 03:00:28 -0800 | [diff] [blame] | 39 | * |
Alexander Dorokhine | 1846584 | 2020-01-21 01:08:57 -0800 | [diff] [blame] | 40 | * @param documentsBytes {@link List}<byte[]> of serialized DocumentProtos. |
| 41 | * @param callback |
| 42 | * {@link AndroidFuture}<{@link AppSearchBatchResult}<{@link String}, {@link Void}>>. |
| 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}<{@link String}, {@link Void}> |
| 46 | * where the keys are document URIs, and the values are {@code null}. |
Alexander Dorokhine | cc22345 | 2020-01-19 03:00:28 -0800 | [diff] [blame] | 47 | */ |
Alexander Dorokhine | 1846584 | 2020-01-21 01:08:57 -0800 | [diff] [blame] | 48 | void putDocuments(in List documentsBytes, in AndroidFuture<AppSearchBatchResult> callback); |
Alexander Dorokhine | cc22345 | 2020-01-19 03:00:28 -0800 | [diff] [blame] | 49 | |
sidchhabra | a7c8f8a | 2020-01-16 18:38:17 -0800 | [diff] [blame] | 50 | /** |
Alexander Dorokhine | 69a8d9f | 2020-03-06 10:43:16 -0800 | [diff] [blame] | 51 | * Retrieves documents from the index. |
| 52 | * |
| 53 | * @param uris The URIs of the documents to retrieve |
Alexander Dorokhine | a95f44f | 2020-03-06 13:53:14 -0800 | [diff] [blame] | 54 | * @param callback |
| 55 | * {@link AndroidFuture}<{@link AppSearchBatchResult}<{@link String}, {@link byte[]}>>. |
| 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}<{@link String}, {@link byte[]}> |
| 59 | * where the keys are document URIs, and the values are serialized Document protos. |
Alexander Dorokhine | 69a8d9f | 2020-03-06 10:43:16 -0800 | [diff] [blame] | 60 | */ |
Alexander Dorokhine | a95f44f | 2020-03-06 13:53:14 -0800 | [diff] [blame] | 61 | void getDocuments(in List<String> uris, in AndroidFuture<AppSearchBatchResult> callback); |
Alexander Dorokhine | 69a8d9f | 2020-03-06 10:43:16 -0800 | [diff] [blame] | 62 | |
| 63 | /** |
sidchhabra | b009838 | 2020-01-22 11:47:22 -0800 | [diff] [blame] | 64 | * Searches a document based on a given specifications. |
sidchhabra | a7c8f8a | 2020-01-16 18:38:17 -0800 | [diff] [blame] | 65 | * |
sidchhabra | b009838 | 2020-01-22 11:47:22 -0800 | [diff] [blame] | 66 | * @param searchSpecBytes Serialized SearchSpecProto. |
| 67 | * @param resultSpecBytes Serialized SearchResultsProto. |
| 68 | * @param scoringSpecBytes Serialized ScoringSpecProto. |
Alexander Dorokhine | e708e18 | 2020-03-06 15:30:34 -0800 | [diff] [blame^] | 69 | * @param callback {@link AndroidFuture}<{@link AppSearchResult}<{@link byte[]}>> |
| 70 | * Will be completed with a serialized {@link SearchResultsProto}. |
sidchhabra | a7c8f8a | 2020-01-16 18:38:17 -0800 | [diff] [blame] | 71 | */ |
Alexander Dorokhine | e708e18 | 2020-03-06 15:30:34 -0800 | [diff] [blame^] | 72 | void query( |
| 73 | in byte[] searchSpecBytes, in byte[] resultSpecBytes, in byte[] scoringSpecBytes, |
| 74 | in AndroidFuture<AppSearchResult> callback); |
Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 75 | } |