Skip to content

Commit

Permalink
feat(tags): improving elastic search templates for tags (#2254)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe-lyons authored Mar 18, 2021
1 parent 8c8de74 commit 7106753
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions datahub-web-react/src/app/shared/tags/AddTagModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function AddTagModal({ updateTags, globalTags, visible, onClose }
</Select.Option>
)) || [];

if (!inputExistsInAutocomplete && inputValue.length > 2 && !loading) {
if (!inputExistsInAutocomplete && inputValue.length > 0 && !loading) {
autocompleteOptions.push(
<Select.Option value={CREATE_TAG_VALUE} key={CREATE_TAG_VALUE}>
<Typography.Link> Create {inputValue}</Typography.Link>
Expand Down Expand Up @@ -121,7 +121,7 @@ export default function AddTagModal({ updateTags, globalTags, visible, onClose }
onSelect={(selected) =>
selected === CREATE_TAG_VALUE ? setShowCreateModal(true) : setSelectedTagValue(String(selected))
}
notFoundContent={loading ? 'loading' : 'type at least 3 character to search'}
notFoundContent={loading ? 'loading' : 'type to search'}
>
{autocompleteOptions}
</TagSelect>
Expand Down
11 changes: 10 additions & 1 deletion gms/impl/src/main/resources/datasetESSearchQueryTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
"default_field": "tags",
"default_operator": "AND"
}
},
{
"query_string": {
"query": "$INPUT",
"analyzer": "whitespace_lowercase",
"boost": 0.0625,
"default_field": "tags.ngram",
"default_operator": "AND"
}
}
]
}
Expand Down Expand Up @@ -104,4 +113,4 @@
],
"score_mode": "multiply"
}
}
}
10 changes: 8 additions & 2 deletions gms/impl/src/main/resources/index/dataset/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@
},
"tags": {
"type": "keyword",
"normalizer": "my_normalizer"
"normalizer": "my_normalizer",
"fields": {
"ngram": {
"type": "text",
"analyzer": "custom_ngram"
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion gms/impl/src/main/resources/index/tags/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": "3",
"min_gram": "1",
"max_gram": "20"
},
"custom_delimiter": {
Expand Down

0 comments on commit 7106753

Please sign in to comment.