Skip to content

Commit

Permalink
Merge pull request #94 from maximehuran/feature/improve-search-accuracy
Browse files Browse the repository at this point in the history
Improve search accurary, boost name match, and add code search
  • Loading branch information
jacquesbh committed Aug 31, 2021
2 parents c6c26cb + eaa2e9c commit 0f1ef8a
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 28 deletions.
60 changes: 46 additions & 14 deletions src/Resources/config/elasticsearch/queries/instant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,49 @@ query:
- term:
channel: "{{CHANNEL}}"
must:
nested:
path: attributes
query:
bool:
must:
multi_match:
query: "{{QUERY}}"
fields:
- attributes.value
fuzziness: 1
should:
rank_feature:
field: attributes.score
boost: 100
- bool:
should:
- term:
code: "{{QUERY}}"
- nested:
path: attributes
query:
- bool:
filter:
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value
fuzziness: 1
should:
- rank_feature:
field: attributes.score
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value^2
should:
- nested:
path: attributes
query:
- bool:
must:
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value^6
- multi_match:
query: "name"
fields:
- attributes.code
- bool:
must:
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value^4
fuzziness: 1
- multi_match:
query: "name"
fields:
- attributes.code
60 changes: 46 additions & 14 deletions src/Resources/config/elasticsearch/queries/search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,49 @@ query:
- term:
channel: "{{CHANNEL}}"
must:
nested:
path: attributes
query:
bool:
must:
multi_match:
query: "{{QUERY}}"
fields:
- attributes.value
fuzziness: 1
should:
rank_feature:
field: attributes.score
boost: 100
- bool:
should:
- term:
code: "{{QUERY}}"
- nested:
path: attributes
query:
- bool:
filter:
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value
fuzziness: 1
should:
- rank_feature:
field: attributes.score
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value^2
should:
- nested:
path: attributes
query:
- bool:
must:
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value^6
- multi_match:
query: "name"
fields:
- attributes.code
- bool:
must:
- multi_match:
query: "{{QUERY}}"
fields:
- attributes.value^4
fuzziness: 1
- multi_match:
query: "name"
fields:
- attributes.code

0 comments on commit 0f1ef8a

Please sign in to comment.