Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tags): improving elastic search templates for tags #2254

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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