eklem / search-index-cookbook

A collection of recipes and how to's on interesting use cases with search-index
MIT License
3 stars 5 forks source link

How to user 0 result queries to something positive: Synonyms #24

Closed eklem closed 8 years ago

eklem commented 8 years ago

Figure out which synonyms to add and how to do it wit OR-search (expand search with more OR-queries, but boost the original query)

fergiemcdowall commented 8 years ago

https://github.com/NaturalNode/natural#stemmers

The general strategy would be to index stems on the way in, and then do a search for the search term and its stem.

eklem commented 8 years ago

I was more thinking about something like: car -> transportation When the user has one vocabulary, and the content/organization a different vocabulary.

fergiemcdowall commented 8 years ago

Sorry- yes, you are talking about synonyms and I am talking about stemming- doh!

fergiemcdowall commented 8 years ago

In a way, synonyms are easier to solve, because you just set up a query processor that substitutes in the synonym

[
  {
    AND: {body: ['car', 'repair']}
  }
]

...transformation ('car' -> 'automobile')...

[
  {
    AND: {body: ['car', 'repair']}
  },
  {
    AND: {body: ['automobile', 'repair']}
  }
]
eklem commented 8 years ago

And, you can get some clear indications that you need to add synonyms if you have logging on 0 results queries.

eklem commented 8 years ago

Could be cool to create a small synonyms module where you could connect a google drive spreadsheet with synonyms.

eklem commented 8 years ago

Just the layout for the synonyms-module.

eklem commented 8 years ago

Fixed with https://github.com/eklem/search-index-cookbook/commit/de1c9b61bb6016f3bbdfaa69a1b8770d580134be