The queryTerms field is useful in order to know which query terms matched in the search result. When performing an exact search, terms and queryTerms are identical. In case of prefix or fuzzy match though, they can be different.
For example, if one searches for "moto" using prefix search, and a document matches because it contains the word "motorcycle", then for that result the terms array will include "motorcycle", while the queryTerms array will include "moto".
The
queryTerms
field is useful in order to know which query terms matched in the search result. When performing an exact search,terms
andqueryTerms
are identical. In case of prefix or fuzzy match though, they can be different.For example, if one searches for
"moto"
using prefix search, and a document matches because it contains the word"motorcycle"
, then for that result theterms
array will include"motorcycle"
, while thequeryTerms
array will include"moto"
.Also see https://github.com/lucaong/minisearch/issues/240 for a use case.