mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-10-03 08:31:50 +02:00
minor refactoring to align with the documentation
This commit is contained in:
11
dist/module-debug/document.js
vendored
11
dist/module-debug/document.js
vendored
@@ -458,20 +458,25 @@ Document.prototype.get = function (id) {
|
||||
|
||||
if (this.db) {
|
||||
return this.index.get(this.field[0]).db.enrich(id).then(function (result) {
|
||||
return result[0] && result[0].doc;
|
||||
return result[0] && result[0].doc || null;
|
||||
});
|
||||
}
|
||||
|
||||
return this.store.get(id);
|
||||
return this.store.get(id) || null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number|string} id
|
||||
* @param {number|string|Object} id
|
||||
* @param {Object} data
|
||||
* @return {Document}
|
||||
*/
|
||||
Document.prototype.set = function (id, data) {
|
||||
|
||||
if ("object" == typeof id) {
|
||||
data = id;
|
||||
id = parse_simple(data, this.key);
|
||||
}
|
||||
|
||||
this.store.set(id, data);
|
||||
return this;
|
||||
};
|
||||
|
Reference in New Issue
Block a user