Skip to content

Commit

Permalink
Fuzzy search the title field
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouncey committed Dec 19, 2017
1 parent 9d30b43 commit cf00e51
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions elastic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,26 @@ function findTheThings(query) {
const searchQuery = {
body: {
query: {
fuzzy: {
friendlySearchString: {
value: query,
fuzziness: 1
}
bool: {
should: [
{
fuzzy: {
friendlySearchString: {
value: query,
fuzziness: 1
}
}
},
{
fuzzy: {
title: {
value: query,
fuzziness: 1,
boost: 2
}
}
}
]
}
},
highlight : {
Expand All @@ -144,7 +159,6 @@ function findTheThings(query) {
reject(err);
return;
}
console.info(response.hits.hits[1]);
resolve(response.hits.hits);
});
});
Expand Down

0 comments on commit cf00e51

Please sign in to comment.