Skip to content

Commit

Permalink
feat(search): expose new search parameter naturalLanguages
Browse files Browse the repository at this point in the history
The `naturalLanguages` parameter provide users with an easy way to implement
voice and natural languages best practices.

The parameter is a list of languages, which applies the following settings:

- `removeStopWords` to the naturalLanguages param value
- `ignorePlurals` to the naturalLanguages param value
- `removeWordsIfNoResults` to allOptional
- adds `analytics tag` of naturalLanguages
- adds `query rule context` of naturalLanguages

The parameter is list of string. Example: `naturalLanguages=["de","fr"]`

Close #592
  • Loading branch information
aseure committed Apr 23, 2020
1 parent af8bbe6 commit 1f104d8
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 2 deletions.
5 changes: 3 additions & 2 deletions algolia/internal/gen/options.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//+build ignore
// +build ignore

package main

Expand Down Expand Up @@ -93,6 +93,7 @@ var options = []Option{
{"queryLanguages", Settings | Search, []string{}, ""},
{"indexLanguages", Settings, []string{}, ""},
{"customNormalization", Settings, map[string]map[string]string{}, ""},
{"naturalLanguages", Search, []string{}, ""},

// Query strategy
{"queryType", Settings | Search, "prefixLast", ""},
Expand Down Expand Up @@ -166,4 +167,4 @@ var options = []Option{
{"limit", Other, 10, ""},
{"safe", Other, false, ""},
{"filterPromotes", Other, false, ""},
}
}
18 changes: 18 additions & 0 deletions algolia/internal/opt/natural_languages.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions algolia/internal/opt/natural_languages_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions algolia/opt/natural_languages.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions algolia/opt/option_getters_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions algolia/search/query_params.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1f104d8

Please sign in to comment.