Questions tagged [lunrjs]

Simple full-text search in your browser

lunr.js is a simple full text search engine for your client side applications. It is designed to be small, yet full featured, enabling you to provide a great search experience without the need for external, server side, search services.

lunr.js has no external dependencies, although it does require a modern browser with ES5 support. In older browsers you can use an ES5 shim, such as augment.js, to provide any missing JavaScript functionality.

https://lunrjs.com/

48 questions
1
vote
1 answer

Lunr - gatsby-plugin-lunr - Can I alter data / index on build?

I've got a Gatsy-Sanity project that needs a search component. For this I though of using gatsby-plugin-lunr. I run into a problem that my nodes are multilingual. For example one of my fields is constructed like: "title": { …
Tim
  • 861
  • 1
  • 12
  • 27
1
vote
1 answer

Regex to replace leading plus characters in query params (++, +- and +)?

I am using lunr.js. This Javascript code below: gets the query parameters from the first search. replaces the binding + characters with spaces. stores the modified query in the search field for the next search. searches using the modified…
Christian
  • 4,902
  • 4
  • 24
  • 42
1
vote
1 answer

lunr.js lunr how to do paging, pagination, or get each page?

since lunr already build the index, I want get first 10 record (page 1) base on whatever search result (search what can I get the whole dataset as result?) second, I want get page 2, 10 record, offset=10, (starting from 11, next 10 record) and so…
hoogw
  • 4,982
  • 1
  • 37
  • 33
1
vote
1 answer

How to create an index with lunr js and reactjs?

I want to use lunr js in an react app to search strings but I don't know how to set up a lunr index. in the documentation it says The Lunr index. This can be an instance of a Lunr index or one that has been exported via JSON.stringify. but I don't…
vuvu
  • 4,886
  • 12
  • 50
  • 73
1
vote
1 answer

Gatsby Lunr Plugin with Ghost source

Trying to implement search functionality in Gatsby with the gastby-plugin-lunr plugin. My gatsby-config.js: { resolve: `gatsby-plugin-lunr`, options: { languages: [ { name: 'en' } ], fields: [ { name:…
nehalist
  • 1,434
  • 18
  • 45
1
vote
1 answer

How to add function to namespace

I have a Node.js typescript application based on lunr and lunr-multilanguage. Loaded @type/lunr but no type definition exists for lunr-multilanguage. Trying to add something to my source code to satisfy the compiler. This is the original…
SiliconValley
  • 1,465
  • 17
  • 30
1
vote
1 answer

How filter search in elasticlunr.js

i am trying to search an index generated by @gatsby-contrib/elasticlunr the generated index looks like this: { "version": "0.9.5", "fields": ["title", "path", "section"], "ref": "id", "documentStore": { "docs": { …
1
vote
0 answers

lunr: how to add a new trimmer

I want to add a trimmer (called improvedTrimmer) before the multilanguage one added by lunr-language. What I'm not able to find is how to pass the existing function to this.pipeline.before() or this.pipeline.after(). Here are my attempts that always…
SiliconValley
  • 1,465
  • 17
  • 30
1
vote
0 answers

Lunr: multilanguage setting needed also when loading an index?

I create and save my lunr index this way: require("lunr-languages/lunr.stemmer.support")(lunr); require("lunr-languages/lunr.multi")(lunr); require("lunr-languages/lunr.it")(lunr); const englishItalianSupport = lunr.multiLanguage("en", "it"); …
SiliconValley
  • 1,465
  • 17
  • 30
1
vote
1 answer

lunr is not returning exact matching as top priority

Am using lunr (elastic lunr0.9.5) as search engine in web browser. It is simple and very fast as well. but it is not listing exactly matched object in first position when it have more. My lunr Configuration in Typescript this.lunrIndex =…
Nat4j
  • 453
  • 2
  • 7
  • 19
1
vote
2 answers

How to handle async loop?

I'm currently working on a project to implement a full-text search client-side in JavaScript based on lunr.js. The thing is, I'm struggling in building then saving the index because I have several asynchronous calls. function…
DnzzL
  • 19
  • 6
1
vote
0 answers

Javascript - Trying to save lunr index to localstorage, can't load properly

I'm trying to create a search feature for my website, so I'm using lunr.js and it requires me to create an index and when I want to search, to load that index and search using it. So, after I create my index, I need to convert it to JSON and load it…
Homerdough
  • 353
  • 1
  • 3
  • 12
1
vote
1 answer

lunr: Return the stem of the searched terms so I can highlight it within results

I'm using lunr to perform a search and I currently am highlighting the search from the value of the search text area, but lunr uses a stemmer and returns results that don't specifically match the full search term. is there a way to access the stem…
Justin Lee
  • 909
  • 4
  • 9
  • 19
0
votes
0 answers

How to search for greek text using lunr.js

I am developing a multilanguage site using hugo cms with english and greek translations and I use lunr.js to search contents. I found that lunr does not support greek (lunr-languages - npm) and I would like to ask if there is a work around to search…
isin
  • 155
  • 1
  • 10
0
votes
0 answers

How to perform full word searching in Lunr.js for Svelte?

Please go through the sample svelte application which uses the Lunr.js library to perform searching through a document: Lunr.js - Svelte I am trying to search for the term 'example'. However, I am only able to get the expected result if I type…