Stay organized with collections Save and categorize content based on your preferences.
A migrator class to translate GenericDocument
from different version of AppSearchSchema
Make non-backwards-compatible changes will delete all stored documents in old schema. You can save your documents by setting Migrator
via the SetSchemaRequest.Builder.setMigrator(String, Migrator)
for each type and target version you want to save.
onDowngrade(int, int, GenericDocument)
or onUpgrade(int, int, GenericDocument)
will be triggered if the version number of the schema stored in AppSearch is different with the version in the request.
If any error or Exception occurred in the onDowngrade(int, int, GenericDocument)
or onUpgrade(int, int, GenericDocument)
, all the setSchema request will be rejected unless the schema changes are backwards-compatible, and stored documents won't have any observable changes.
clone()
boolean voidfinalize()
final Class<?>getClass()
inthashCode()
final voidnotify()
final voidnotifyAll()
StringtoString()
final voidwait(long arg0, int arg1)
final voidwait(long arg0)
final voidwait()
Public Constructors Public Methods public abstract GenericDocument onDowngrade (int currentVersion, int finalVersion, GenericDocument document) Parameters currentVersion The current version of the document's schema. finalVersion The final version that documents need to be migrated to. document TheGenericDocument
need to be translated to new version. public abstract GenericDocument onUpgrade (int currentVersion, int finalVersion, GenericDocument document) Parameters currentVersion The current version of the document's schema. finalVersion The final version that documents need to be migrated to. document The GenericDocument
need to be translated to new version. public abstract boolean shouldMigrate (int currentVersion, int finalVersion)
Returns true
if this migrator's source type needs to be migrated to update from currentVersion to finalVersion.
Migration won't be triggered if currentVersion is equal to finalVersion even if shouldMigrate(int, int)
return true;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["`Migrator` helps translate `GenericDocument` objects between different versions of `AppSearchSchema` to preserve data during schema updates."],["Non-backwards-compatible schema changes without a `Migrator` will result in the deletion of all existing documents."],["`onUpgrade` and `onDowngrade` methods are called to handle document migration during schema version changes."],["Any errors during migration will cause the schema update to be rejected unless the changes are backwards-compatible."],["`shouldMigrate` determines if a document needs to be migrated based on the current and target schema versions."]]],["The `Migrator` class translates `GenericDocument` between different `AppSearchSchema` versions. To save documents during non-backwards-compatible schema changes, use `SetSchemaRequest.Builder.setMigrator`. `onDowngrade` or `onUpgrade` methods are triggered when the schema version differs from the request, allowing migration to older or newer versions, respectively. If an error happens in any of this methods, the `SetSchemaRequest` will be rejected, and the current stored documents will remain unchanged. `shouldMigrate` determines if migration is necessary.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4