public class MirroredIndex extends Index
OfflineClient.getIndex(String)
to obtain an
instance.
**Note:** Requires Algolia Offline Core. OfflineClient.enableOfflineMode(String)
must be called with a
valid license key prior to calling any offline-related method.
When created, an instance of this class has its `mirrored` flag set to false, and behaves like a normal,
online Index
. When the `mirrored` flag is set to true, the index becomes capable of acting upon local data.
**Warning:** It is a programming error to call methods acting on the local data when `mirrored` is false. Doing so
will result in an assertion exception being thrown.
## Request strategy
When the index is mirrored and the device is online, it becomes possible to transparently switch between online and
offline requests. There is no single best strategy for that, because it depends on the use case and the current
network conditions. You can choose the strategy via setRequestStrategy
. The
default is FALLBACK_ON_FAILURE
, which will always target the online API first,
then fallback to the offline mirror in case of failure (including network unavailability).
**Note:** If you want to explicitly target either the online API or the offline mirror, doing so is always possible
using the searchOnlineAsync
or searchOfflineAsync
methods.
**Note:** The strategy applies to:
- `searchAsync`
- `searchDisjunctiveFacetingAsync`
- `multipleQueriesAsync`
- `getObjectAsync`
- `getObjectsAsync`
## Bootstrapping
Before the first sync has successfully completed, a mirrored index is not available offline, because it has simply
no data to search in yet. In most cases, this is not a problem: the app will sync as soon as instructed, so unless
the device is offline when the app is started for the first time, or unless search is required right after the
first launch, the user should not notice anything.
However, in some cases, you might need to have offline data available as soon as possible. To achieve that,
`MirroredIndex` provides a **manual build** feature.
### Manual build
Manual building consists in specifying the source data for your index from local files, instead of downloading it
from the API. Namely, you need:
- the **index settings** (one JSON file); and
- the **objects** (as many JSON files as needed, each containing an array of objects).
Those files are typically embedded in the application as resources, although any other origin works too.
### Conditional bootstrapping
To avoid replacing the local mirror every time the app is started (and potentially overwriting more recent data
synced from the API), you should test whether the index already has offline data using hasOfflineData()
.
#### Discussion
**Warning:** We strongly advise against prepackaging index files. While it may work in some cases, Algolia Offline
makes no guarantee whatsoever that the index file format will remain backward-compatible forever, nor that it
is independent of the hardware architecture (e.g. 32 bits vs 64 bits, or Little Endian vs Big Endian). Instead,
always use the manual build feature.
While a manual build involves computing the offline index on the device, and therefore incurs a small delay before
the mirror is actually usable, using plain JSON offers several advantages compared to prepackaging the index file
itself:
- You only need to ship the raw object data, which is smaller than shipping an entire index file, which contains
both the raw data *and* indexing metadata.
- Plain JSON compresses well with standard compression techniques like GZip, whereas an index file uses a binary
format which doesn't compress very efficiently.
- Build automation is facilitated: you can easily extract the required data from your back-end, whereas building
an index would involve running the app on each mobile platform as part of your build process and capturing the
filesystem.
Also, the build process is purposedly single-threaded across all indices, which means that on most modern devices
with multi-core CPUs, the impact of manual building on the app's performance will be very moderate, especially
regarding UI responsiveness.
## Listeners
You may register a SyncListener
to listen for sync-related events. The listener methods will be called using
the client's completion executor (which is, by default, the main thread).
## Limitations
Algolia's core features are fully supported offline, including (but not limited to): **ranking**,
**typo tolerance**, **filtering**, **faceting**, **highlighting/snippeting**...
However, and partly due to tight memory, CPU and disk space constraints, some features are disabled:
- **Synonyms** are only partially supported:
- Multi-way ("regular") synonyms are fully supported.
- One-way synonyms are not supported.
- Alternative corrections are limited to one alternative (compared to multiple alternatives with online indices).
- Placeholders are fully supported.
- Dictionary-based **plurals** are not supported. ("Simple" plurals with a final S are supported.)
- **IP geolocation** (see Query.setAroundLatLngViaIP(Boolean)
) is not supported.
- **CJK segmentation** is not supported.Modifier and Type | Class and Description |
---|---|
static class |
MirroredIndex.DataSelectionQuery
A data selection query.
|
static class |
MirroredIndex.Strategy
Strategy to choose between online and offline search.
|
static class |
MirroredIndex.SyncStats
Statistics about a sync.
|
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_DELAY_BETWEEN_SYNCS
Default minimum delay between two syncs (in milliseconds).
|
static long |
DEFAULT_OFFLINE_FALLBACK_TIMEOUT
Default delay before launching an offline request (in milliseconds).
|
static String |
JSON_KEY_ORIGIN
Key used to indicate the origin of results in the returned JSON.
|
static String |
JSON_VALUE_ORIGIN_LOCAL
Value for `JSON_KEY_ORIGIN` indicating that the results come from the local mirror.
|
static String |
JSON_VALUE_ORIGIN_REMOTE
Value for `JSON_KEY_ORIGIN` indicating that the results come from the online API.
|
DEFAULT_SETTINGS_VERSION
Modifier and Type | Method and Description |
---|---|
void |
addBuildListener(BuildListener listener)
Add a listener for build events.
|
void |
addDataSelectionQuery(MirroredIndex.DataSelectionQuery query)
Add a data selection query to this index.
|
void |
addSyncListener(SyncListener listener)
Add a listener for sync events.
|
Request |
browseMirrorAsync(Query query,
CompletionHandler completionHandler)
Browse the local mirror (initial call).
|
Request |
browseMirrorFromAsync(String cursor,
CompletionHandler completionHandler)
Browse the local mirror (subsequent calls).
|
Request |
buildOfflineFromFiles(File settingsFile,
File... objectFiles) |
Request |
buildOfflineFromFiles(File settingsFile,
File[] objectFiles,
CompletionHandler completionHandler)
Replace the local mirror with local data stored on the filesystem.
|
Request |
buildOfflineFromRawResources(android.content.res.Resources resources,
int settingsResId,
int... objectsResIds) |
Request |
buildOfflineFromRawResources(android.content.res.Resources resources,
int settingsResId,
int[] objectsResIds,
CompletionHandler completionHandler)
Replace the local mirror with local data stored in raw resources.
|
OfflineClient |
getClient() |
MirroredIndex.DataSelectionQuery[] |
getDataSelectionQueries() |
long |
getDelayBetweenSyncs() |
long |
getDelayBetweenSyncs(java.util.concurrent.TimeUnit unit)
Get the delay between two syncs.
|
Request |
getObjectAsync(String objectID,
Collection<String> attributesToRetrieve,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Get an individual object from the online API, falling back to the local mirror in case of error (when enabled).
|
Request |
getObjectOfflineAsync(String objectID,
CompletionHandler completionHandler)
Get an individual object, explicitly targeting the offline mirror, not the online API.
|
Request |
getObjectOfflineAsync(String objectID,
List<String> attributesToRetrieve,
CompletionHandler completionHandler)
Get an individual object, explicitly targeting the offline mirror, not the online API.
|
Request |
getObjectOnlineAsync(String objectID,
CompletionHandler completionHandler)
Get an individual object, explicitly targeting the online API, not the offline mirror.
|
Request |
getObjectOnlineAsync(String objectID,
List<String> attributesToRetrieve,
CompletionHandler completionHandler)
Get an individual object, explicitly targeting the online API, not the offline mirror.
|
Request |
getObjectOnlineAsync(String objectID,
List<String> attributesToRetrieve,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Get an individual object, explicitly targeting the online API, not the offline mirror.
|
Request |
getObjectsAsync(Collection<String> objectIDs,
Collection<String> attributesToRetrieve,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Get individual objects from the online API, falling back to the local mirror in case of error (when enabled).
|
Request |
getObjectsOfflineAsync(List<String> objectIDs,
CompletionHandler completionHandler)
Get individual objects, explicitly targeting the offline mirror, not the online API.
|
Request |
getObjectsOfflineAsync(List<String> objectIDs,
List<String> attributesToRetrieve,
CompletionHandler completionHandler)
Get individual objects, explicitly targeting the offline mirror, not the online API.
|
Request |
getObjectsOnlineAsync(List<String> objectIDs,
CompletionHandler completionHandler)
Get individual objects, explicitly targeting the online API, not the offline mirror.
|
Request |
getObjectsOnlineAsync(List<String> objectIDs,
List<String> attributesToRetrieve,
CompletionHandler completionHandler)
Get individual objects, explicitly targeting the online API, not the offline mirror.
|
Request |
getObjectsOnlineAsync(List<String> objectIDs,
List<String> attributesToRetrieve,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Get individual objects, explicitly targeting the online API, not the offline mirror.
|
long |
getOfflineFallbackTimeout() |
MirroredIndex.Strategy |
getRequestStrategy() |
boolean |
hasOfflineData()
Test if this index has offline data on disk.
|
boolean |
isMirrored() |
Request |
multipleQueriesAsync(Collection<Query> queries,
Client.MultipleQueriesStrategy strategy,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Run multiple queries on this index with one API call.
|
Request |
multipleQueriesOfflineAsync(List<Query> queries,
Client.MultipleQueriesStrategy strategy,
CompletionHandler completionHandler)
Run multiple queries on this index, explicitly targeting the offline mirror.
|
Request |
multipleQueriesOnlineAsync(List<Query> queries,
Client.MultipleQueriesStrategy strategy,
CompletionHandler completionHandler)
Run multiple queries on this index, explicitly targeting the online API.
|
Request |
multipleQueriesOnlineAsync(List<Query> queries,
Client.MultipleQueriesStrategy strategy,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Run multiple queries on this index, explicitly targeting the online API.
|
void |
removeBuildListener(BuildListener listener)
Remove a listener for build events.
|
void |
removeSyncListener(SyncListener listener)
Remove a listener for sync events.
|
Request |
searchAsync(Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Search the online API, falling back to the local mirror if enabled in case of error.
|
Request |
searchForFacetValuesAsync(String facetName,
String text,
Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Searches for some text in a facet values, optionally restricting the returned values to those contained in objects matching other (regular) search criteria.
|
Request |
searchForFacetValuesOffline(String facetName,
String text,
Query query,
CompletionHandler completionHandler)
Search for facet values, explicitly targeting the offline mirror, not the online API.
|
Request |
searchForFacetValuesOnline(String facetName,
String text,
Query query,
CompletionHandler completionHandler)
Search for facet values, explicitly targeting the online API, not the offline mirror.
|
Request |
searchForFacetValuesOnline(String facetName,
String text,
Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Search for facet values, explicitly targeting the online API, not the offline mirror.
|
Request |
searchOfflineAsync(Query query,
CompletionHandler completionHandler)
Search the local mirror.
|
Request |
searchOnlineAsync(Query query,
CompletionHandler completionHandler)
Search the online API.
|
Request |
searchOnlineAsync(Query query,
RequestOptions requestOptions,
CompletionHandler completionHandler)
Search the online API.
|
void |
setDataSelectionQueries(MirroredIndex.DataSelectionQuery... queries)
Replace all data selection queries associated to this index.
|
void |
setDelayBetweenSyncs(long delayBetweenSyncs)
Set the delay after which data is considered to be obsolete.
|
void |
setDelayBetweenSyncs(long duration,
java.util.concurrent.TimeUnit unit)
Set the delay after which data is considered to be obsolete.
|
void |
setMirrored(boolean mirrored) |
void |
setOfflineFallbackTimeout(long offlineFallbackTimeout) |
void |
setOfflineFallbackTimeout(long offlineFallbackTimeout,
java.util.concurrent.TimeUnit unit) |
void |
setRequestStrategy(MirroredIndex.Strategy requestStrategy) |
void |
sync()
Launch a sync.
|
void |
syncIfNeeded()
Launch a sync only if the data is obsolete.
|
addObject, addObject, addObjectAsync, addObjectAsync, addObjectAsync, addObjects, addObjectsAsync, addObjectsAsync, browseAsync, browseAsync, browseFromAsync, browseFromAsync, clearIndex, clearIndexAsync, clearIndexAsync, clearSearchCache, deleteBy, deleteBy, deleteByAsync, deleteByAsync, deleteByQuery, deleteByQueryAsync, deleteByQueryAsync, deleteObject, deleteObjectAsync, deleteObjectAsync, deleteObjects, deleteObjectsAsync, deleteObjectsAsync, disableSearchCache, enableSearchCache, enableSearchCache, getObject, getObject, getObjectAsync, getObjectAsync, getObjects, getObjects, getObjectsAsync, getObjectsAsync, getObjectsAsync, getRawIndexName, getSettings, getSettings, getSettingsAsync, getSettingsAsync, multipleQueriesAsync, partialUpdateObject, partialUpdateObjectAsync, partialUpdateObjectAsync, partialUpdateObjectAsync, partialUpdateObjects, partialUpdateObjectsAsync, partialUpdateObjectsAsync, partialUpdateObjectsAsync, saveObject, saveObjectAsync, saveObjectAsync, saveObjects, saveObjectsAsync, saveObjectsAsync, search, searchDisjunctiveFacetingAsync, searchDisjunctiveFacetingAsync, searchForFacetValues, searchForFacetValues, searchForFacetValuesAsync, searchForFacetValuesAsync, searchSync, searchSync, setSettings, setSettingsAsync, setSettingsAsync, toString, waitTask, waitTask, waitTaskAsync, waitTaskAsync
searchAsync
public static final String JSON_KEY_ORIGIN
public static final String JSON_VALUE_ORIGIN_LOCAL
public static final String JSON_VALUE_ORIGIN_REMOTE
public static final long DEFAULT_DELAY_BETWEEN_SYNCS
public static final long DEFAULT_OFFLINE_FALLBACK_TIMEOUT
public OfflineClient getClient()
public boolean isMirrored()
public void setMirrored(boolean mirrored)
public void addDataSelectionQuery(@NonNull MirroredIndex.DataSelectionQuery query)
query
- The data selection query to add.public void setDataSelectionQueries(@NonNull MirroredIndex.DataSelectionQuery... queries)
queries
- The new data selection queries. (May be empty, although this will actually empty your mirror!)@NonNull public MirroredIndex.DataSelectionQuery[] getDataSelectionQueries()
public long getDelayBetweenSyncs()
public void setDelayBetweenSyncs(long delayBetweenSyncs)
delayBetweenSyncs
- The delay between syncs, in milliseconds.public long getDelayBetweenSyncs(@NonNull java.util.concurrent.TimeUnit unit)
unit
- The unit in which the result will be expressed.unit
.public void setDelayBetweenSyncs(long duration, @NonNull java.util.concurrent.TimeUnit unit)
duration
- The delay between syncs, expressed in unit
.unit
- The unit in which duration
is expressed.public void sync()
IllegalStateException
- If no data selection queries were set.public void syncIfNeeded()
IllegalStateException
- If no data selection queries were set.public boolean hasOfflineData()
public Request buildOfflineFromFiles(@NonNull File settingsFile, @NonNull File[] objectFiles, @Nullable CompletionHandler completionHandler)
settingsFile
- Absolute path to the file containing the index settings, in JSON format.objectFiles
- Absolute path(s) to the file(s) containing the objects. Each file must contain an array of
objects, in JSON format.completionHandler
- Optional completion handler to be notified of the build's outcome.public Request buildOfflineFromFiles(@NonNull File settingsFile, @NonNull File... objectFiles)
public Request buildOfflineFromRawResources(@NonNull android.content.res.Resources resources, @NonNull int settingsResId, @NonNull int[] objectsResIds, @Nullable CompletionHandler completionHandler)
resources
- A Resources
instance to read resources from.settingsResId
- Resource identifier of the index settings, in JSON format.objectsResIds
- Resource identifiers of the various objects files. Each file must contain an array of
objects, in JSON format.completionHandler
- Optional completion handler to be notified of the build's outcome.public Request buildOfflineFromRawResources(@NonNull android.content.res.Resources resources, @NonNull int settingsResId, @NonNull int... objectsResIds)
public MirroredIndex.Strategy getRequestStrategy()
public void setRequestStrategy(MirroredIndex.Strategy requestStrategy)
public long getOfflineFallbackTimeout()
public void setOfflineFallbackTimeout(long offlineFallbackTimeout)
public void setOfflineFallbackTimeout(long offlineFallbackTimeout, java.util.concurrent.TimeUnit unit)
public Request searchAsync(@NonNull Query query, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
searchAsync
in class Index
query
- Search query.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request searchOnlineAsync(@NonNull Query query, @NonNull CompletionHandler completionHandler)
query
- Search query.completionHandler
- The listener that will be notified of the request's outcome.public Request searchOnlineAsync(@NonNull Query query, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
query
- Search query.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request searchOfflineAsync(@NonNull Query query, @NonNull CompletionHandler completionHandler)
query
- Search query.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request multipleQueriesAsync(@NonNull Collection<Query> queries, Client.MultipleQueriesStrategy strategy, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
Index
Client.multipleQueriesAsync(List, Client.MultipleQueriesStrategy, CompletionHandler)
where the targeted index is always the receiver.multipleQueriesAsync
in class Index
queries
- The queries to run.strategy
- The strategy to use.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request multipleQueriesOnlineAsync(@NonNull List<Query> queries, Client.MultipleQueriesStrategy strategy, @NonNull CompletionHandler completionHandler)
queries
- Queries to run.strategy
- Strategy to use.completionHandler
- The listener that will be notified of the request's outcome.public Request multipleQueriesOnlineAsync(@NonNull List<Query> queries, Client.MultipleQueriesStrategy strategy, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
queries
- Queries to run.strategy
- Strategy to use.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request multipleQueriesOfflineAsync(@NonNull List<Query> queries, Client.MultipleQueriesStrategy strategy, @NonNull CompletionHandler completionHandler)
queries
- Queries to run.strategy
- Strategy to use.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request browseMirrorAsync(@NonNull Query query, @NonNull CompletionHandler completionHandler)
Index.browseAsync(com.algolia.search.saas.Query, com.algolia.search.saas.CompletionHandler)
.query
- Browse query. Same restrictions as the online API.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request browseMirrorFromAsync(@NonNull String cursor, @NonNull CompletionHandler completionHandler)
Index.browseFromAsync(java.lang.String, com.algolia.search.saas.CompletionHandler)
.cursor
- Cursor to browse from.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request getObjectAsync(@NonNull String objectID, @Nullable Collection<String> attributesToRetrieve, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
getObjectAsync
in class Index
objectID
- Identifier of the object to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectOnlineAsync(@NonNull String objectID, @Nullable List<String> attributesToRetrieve, @NonNull CompletionHandler completionHandler)
objectID
- Identifier of the object to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectOnlineAsync(@NonNull String objectID, @Nullable List<String> attributesToRetrieve, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
objectID
- Identifier of the object to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectOnlineAsync(@NonNull String objectID, @NonNull CompletionHandler completionHandler)
objectID
- Identifier of the object to retrieve.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectOfflineAsync(@NonNull String objectID, @Nullable List<String> attributesToRetrieve, @NonNull CompletionHandler completionHandler)
objectID
- Identifier of the object to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request getObjectOfflineAsync(@NonNull String objectID, @NonNull CompletionHandler completionHandler)
objectID
- Identifier of the object to retrieve.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request getObjectsAsync(@NonNull Collection<String> objectIDs, @Nullable Collection<String> attributesToRetrieve, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
getObjectsAsync
in class Index
objectIDs
- Identifiers of objects to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectsOnlineAsync(@NonNull List<String> objectIDs, @Nullable List<String> attributesToRetrieve, @NonNull CompletionHandler completionHandler)
objectIDs
- Identifiers of objects to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectsOnlineAsync(@NonNull List<String> objectIDs, @Nullable List<String> attributesToRetrieve, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
objectIDs
- Identifiers of objects to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.requestOptions
- Request-specific options.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectsOnlineAsync(@NonNull List<String> objectIDs, @NonNull CompletionHandler completionHandler)
objectIDs
- Identifiers of objects to retrieve.completionHandler
- The listener that will be notified of the request's outcome.public Request getObjectsOfflineAsync(@NonNull List<String> objectIDs, @Nullable List<String> attributesToRetrieve, @NonNull CompletionHandler completionHandler)
objectIDs
- Identifiers of objects to retrieve.attributesToRetrieve
- Attributes to retrieve. If `null` or if at least one item is `*`, all retrievable
attributes will be retrieved.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request getObjectsOfflineAsync(@NonNull List<String> objectIDs, @NonNull CompletionHandler completionHandler)
objectIDs
- Identifiers of objects to retrieve.completionHandler
- The listener that will be notified of the request's outcome.IllegalStateException
- if mirroring is not activated on this index.public Request searchForFacetValuesAsync(@NonNull String facetName, @NonNull String text, @Nullable Query query, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
Index
searchForFacetValuesAsync
in class Index
facetName
- The name of the facet to search. It must have been declared in the index's `attributesForFaceting` setting with the `searchable()` modifier.text
- The text to search for in the facet's values.query
- An optional query to take extra search parameters into account. There parameters apply to index objects like in a regular search query. Only facet values contained in the matched objects will be returnedrequestOptions
- Request-specific options.completionHandler
- A Completion handler that will be notified of the request's outcome.public Request searchForFacetValuesOnline(@NonNull String facetName, @NonNull String text, @Nullable Query query, @NonNull CompletionHandler completionHandler)
Index.searchForFacetValues(String, String, Query, CompletionHandler)
.public Request searchForFacetValuesOnline(@NonNull String facetName, @NonNull String text, @Nullable Query query, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler)
Index.searchForFacetValues(String, String, Query, CompletionHandler)
.public Request searchForFacetValuesOffline(@NonNull String facetName, @NonNull String text, @Nullable Query query, @NonNull CompletionHandler completionHandler)
public void addSyncListener(@NonNull SyncListener listener)
listener
- The listener to add.public void removeSyncListener(@NonNull SyncListener listener)
listener
- The listener to remove.public void addBuildListener(@NonNull BuildListener listener)
listener
- The listener to add.public void removeBuildListener(@NonNull BuildListener listener)
listener
- The listener to remove.