Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
En la Biblioteca Flexsearch, ¿Cómo buscar todo el texto coincidente?

Tengo un texto grande con 10 palabras "infernales" en el documento, y quiero que flexSearch recupere todas las coincidencias en el texto completo por mí. Actualmente uso el index. método de búsqueda, pero solo puede recuperar el primer infierno, no incluir el resto. No sé qué está pasando.

mi código central:

 import Flexsearch from "flexsearch"; //英文搜索const searchENOptions = { encode: "icase", tokenize: "reverse", resolution: 9, doc: { id: "key", field: ["content"], }, }; this.indexEN = new Flexsearch(searchENOptions); const { pages } = this.$site; this.indexEN.add(pages); const query = this.query.trim().toLowerCase(); // query keywords let result = null; if (!query) { return; } const regex = /[\x00-\x7F]/g; // currently, the result only has one item. result = this.indexEN.search(query).map((page) => { return { ...page, text: this.getSuggestionText(page), }; }); } function getSuggestionText(page) { const content = page.content; // fullText const queryIndex = content .toLowerCase() .indexOf(this.query.toLowerCase()); const queryFirstWord = this.query.split(" ")[0]; let startIndex = queryIndex === -1 ? content.toLowerCase().indexOf(queryFirstWord.toLowerCase()) : queryIndex; let prefix = ""; if (startIndex > 15) { startIndex -= 15; prefix = "... "; } const text = page.content.substr(startIndex, SEARCH_RESULT_LENGTH); return highlightText(text, this.query) + prefix; }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!