minisearch icon indicating copy to clipboard operation
minisearch copied to clipboard

Prefix search not working

Open Thomas-1985 opened this issue 2 years ago • 0 comments

Hi

package version: 5.0.0

Currently i use minisearch like this


const data = [
  {
    "title": "Old Man's War",
    "author": "John Scalzi"
  },
  {
    "title": "The Lock Artist",
    "author": "Steve"
  },
  {
    "title": "Artist for Life",
    "author": "Michelangelo"
  },
  {
    "title": "Artists for Life",
    "author": "Michelangelo"
  }
];

    const searchOptions = {
      combineWith: "OR",
      searchOptions: {
        prefix: true,
        fuzzy: false
      }
    }

    const query = 'Artist';

    const engine = new MiniSearch({
      fields: ['title'],
      searchOptions: searchOptions
      })

    engine.addAll(data);
    const searchResult = engine.search(query);

I get a search result if there is the word "Artist" but not i.e. "Artists" . What am i doing wrong here?

Another question, "Awesomeartists" would never match (its not a prefix), or am i wrong?

Thomas-1985 avatar Sep 17 '22 20:09 Thomas-1985