1
0
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:
Thomas Wilkerling
2025-03-30 21:57:37 +02:00
parent bdfddd5509
commit 40f17691bf
118 changed files with 870 additions and 816 deletions

View File

@@ -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;
};