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:
10
dist/module-debug/document/search.js
vendored
10
dist/module-debug/document/search.js
vendored
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user