UNPKG

ravendb

Version:
40 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Highlightings = void 0; /** * Query highlightings for the documents. */ class Highlightings { _highlightings; _fieldName; constructor(fieldName) { this._fieldName = fieldName; this._highlightings = new Map(); } get fieldName() { return this._fieldName; } get resultIndents() { return Object.keys(this._highlightings); } /** * @param key The document id, or the map/reduce key field. * @return Returns the list of document's field highlighting fragments. */ getFragments(key) { const result = this._highlightings.get(key); return result || []; } update(highlightings) { this._highlightings.clear(); if (!highlightings || !(this._fieldName in highlightings)) { return; } const result = highlightings[this._fieldName]; for (const key of Object.keys(result)) { this._highlightings.set(key, result[key]); } } } exports.Highlightings = Highlightings; //# sourceMappingURL=Hightlightings.js.map