1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-25 12:58:59 +02:00
Files
flexsearch/dist/module-debug/preset.js
Thomas Wilkerling 25e4b5d712 bundle pre-release
2025-03-17 01:12:32 +01:00

57 lines
1.1 KiB
JavaScript

import { is_string } from "./common.js";
import { IndexOptions } from "./type.js";
/**
* @enum {Object}
* @const
*/
const presets = {
memory: {
resolution: 1
},
performance: {
resolution: 6,
fastupdate: /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */ // splice:
!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/,
context: {
depth: 1,
resolution: 3
}
},
match: {
tokenize: "forward"
},
score: {
resolution: 9,
context: {
depth: 2,
resolution: 9
}
}
};
/**
*
* @param {!IndexOptions|string} options
* @return {IndexOptions}
*/
export default function apply_preset(options) {
const preset = is_string(options) ? options : options.preset;
if (preset) {
if (!presets[preset]) {
console.warn("Preset not found: " + preset);
}
options = Object.assign({}, presets[preset], /** @type {Object} */options);
}
return options;
}