1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-10-03 16:41:50 +02:00

more tests, more fixes

This commit is contained in:
Thomas Wilkerling
2025-03-24 18:33:20 +01:00
parent 63531ef4f1
commit e878ce5f99
113 changed files with 6722 additions and 5621 deletions

View File

@@ -1,5 +1,5 @@
import { DocumentSearchOptions, DocumentSearchResults, EnrichedDocumentSearchResults, MergedDocumentSearchResults, EnrichedSearchResults, SearchResults, IntermediateSearchResults } from "../type.js";
import { DocumentSearchOptions, DocumentSearchResults, EnrichedDocumentSearchResults, MergedDocumentSearchResults, MergedDocumentSearchEntry, EnrichedSearchResults, SearchResults, IntermediateSearchResults } from "../type.js";
import { create_object, is_array, is_object, is_string, parse_simple } from "../common.js";
import { intersect_union } from "../intersect.js";
import Document from "../document.js";
@@ -105,7 +105,7 @@ Document.prototype.search = function (query, limit, options, _promises) {
enrich = this.store && options.enrich && resolve;
highlight = options.highlight && enrich;
highlight = enrich && options.highlight;
limit = options.limit || limit;
offset = options.offset || 0;
limit || (limit = 100);
@@ -438,7 +438,7 @@ function highlight_fields(result, query, index, field, tree, template) {
// if(typeof template === "string"){
// template = new RegExp(template, "g");
// }
console.log("template", template);
let encoder, query_enc, tokenize;
@@ -518,7 +518,7 @@ function highlight_fields(result, query, index, field, tree, template) {
* @return {MergedDocumentSearchResults}
*/
function merge_fields(fields, limit) {
/** @type {MergedDocumentSearchResults} */
/** @type {Array<MergedDocumentSearchEntry>} */
const final = [],
set = create_object();
@@ -547,7 +547,7 @@ function merge_fields(fields, limit) {
return final;
}
entry.field = set[id] = [field.field];
final.push(entry);
final.push( /** @type {MergedDocumentSearchEntry} */entry);
} else {
tmp.push(field.field);
}