function Index(options, _register) {

    if (!this || this.constructor !== Index) {
        return new Index(options);
    }

    options = /** @type IndexOptions */options ? apply_preset(options) : {};

    /** @type {*} */
    let tmp = options.context;
    /** @type ContextOptions */
    const context = /** @type ContextOptions */!0 === tmp ? { depth: 1 } : tmp || {},
          encoder = is_string(options.encoder) ? Charset[options.encoder] : options.encode || options.encoder || {};

    /** @type Encoder */
    this.encoder = encoder.encode ? encoder : "object" == typeof encoder ? new Encoder( /** @type {EncoderOptions} */encoder) : { encode: encoder };

    this.compress = options.compress || options.compression || !1;


    this.resolution = options.resolution || 9;
    this.tokenize = tmp = (tmp = options.tokenize) && "default" !== tmp && "exact" !== tmp && tmp || "strict";
    this.depth = "strict" === tmp && context.depth || 0;
    this.bidirectional = !1 !== context.bidirectional;
    this.fastupdate = !!options.fastupdate;
    this.score = options.score || null;

    tmp = options.keystore || 0;
    tmp && (this.keystore = tmp);

    this.map = tmp && !0 ? new KeystoreMap(tmp) : new Map();
    this.ctx = tmp && !0 ? new KeystoreMap(tmp) : new Map();
    /** @type {
     *   Set<string|number>|
     *   Map<Array<string|number>>|
     *   KeystoreSet<string|number>|
     *   KeystoreMap<Array<string|number>>
     * } */
    this.reg = _register || (this.fastupdate ? tmp && !0 ? new KeystoreMap(tmp) : new Map() : tmp && !0 ? new KeystoreSet(tmp) : new Set());
    this.resolution_ctx = context.resolution || 3;
    this.rtl = encoder.rtl || options.rtl || !1;

    this.cache = (tmp = options.cache || null) && new Cache(tmp);

    this.resolve = !1 !== options.resolve;

    if (tmp = options.db) {
        this.db = this.mount(tmp);
    }
    this.commit_auto = !1 !== options.commit;
    this.commit_task = [];
    this.commit_timer = null;

    this.priority = options.priority || 4;
}
@constructor
@param {IndexOptions|string=} options Options or preset as string
@param {Map|Set|KeystoreSet|KeystoreMap=} _register