market icon indicating copy to clipboard operation
market copied to clipboard

Autocomplete tags in form

Open mihaisc opened this issue 4 years ago • 3 comments

There are 2 steps here :

  • create an autocomplete component
  • use the component for tags in the publish form by passing to it a list of tags. I will provide a query in this issue to fetch all the tags , but it's currently not possible in aquarius

mihaisc avatar Jun 10 '21 07:06 mihaisc

a list of tags can be easily fetched with the following query:

{
    "from": 0,
    "size": 0,
    "aggs": {
        "tags": {
            "terms": {
                "field": "metadata.tags.keyword"
            }
        }
    }
}

result:

{
    "_shards": {
        "failed": 0,
        "skipped": 0,
        "successful": 2,
        "total": 2
    },
    "aggregations": {
        "tags": {
            "buckets": [
                {
                    "doc_count": 18,
                    "key": ""
                },
                {
                    "doc_count": 11,
                    "key": "test"
                },
                {
                    "doc_count": 4,
                    "key": "algo"
                },
                {
                    "doc_count": 2,
                    "key": "c2d"
                },
                {
                    "doc_count": 2,
                    "key": "example"
                },
                {
                    "doc_count": 1,
                    "key": "a"
                },
                {
                    "doc_count": 1,
                    "key": "aaa"
                },
                {
                    "doc_count": 1,
                    "key": "b"
                },
                {
                    "doc_count": 1,
                    "key": "data"
                },
                {
                    "doc_count": 1,
                    "key": "dataset"
                }
            ],
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 13
        }
    },
    "hits": {
        "hits": [],
        "max_score": null,
        "total": {
            "relation": "eq",
            "value": 43
        }
    },
    "timed_out": false,
    "took": 4
}

mihaisc avatar Apr 08 '22 08:04 mihaisc

For the autocomplete component would you be fine if we use the React-Select package?

LucaMilanese90 avatar May 18 '22 17:05 LucaMilanese90

Fine by me. We add a bit of custom css to make it look like the other inputs and it's wonderful

mihaisc avatar May 19 '22 10:05 mihaisc