Hey @jeremieburtin, couchbase FTS does not natively support auto complete but this kind of a thing can be implemented within your application via certain token filters that we provide, as highlighted in this article …
As for your question on how to configure your index to match all the sub strings of “jérémie”, I’d try setting up an index mapping over the field that carries the term, with a custom analyzer using the edge ngram token filter (with min length: 2 and max length: 7) and also the to_lower tokenizer (to ignore case).
Setting up one such index mapping would store the following tokens for the term “jérémie” …
jé - 423 (1a7) posting byteSize: 18 cardinality: 1
jér - 462 (1ce) posting byteSize: 18 cardinality: 1
jéré - 501 (1f5) posting byteSize: 18 cardinality: 1
jérém - 540 (21c) posting byteSize: 18 cardinality: 1
jérémi - 579 (243) posting byteSize: 18 cardinality: 1
jérémie - 618 (26a) posting byteSize: 18 cardinality: 1
Any of these tokens can be searched for.
Note that if you’d like to match terms that aren’t indexed here but are close like “jérem”, “jrmie”, “jeremi”, “je” etc. you could employ fuzziness (edit distance) within your match query.
Here’s a sample match query with fuzziness factor 2 …
{"query": {"match": "jeremi", "field": "name", "fuzziness": 2}}
, or via a query string …
name:jeremi~2
Here’s the sample index mapping …
{
"type": "fulltext-index",
"name": "default",
"uuid": "",
"sourceType": "couchbase",
"sourceName": "default",
"sourceUUID": "",
"planParams": {
"maxPartitionsPerPIndex": 171,
},
"params": {
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "type_field",
"type_field": "type"
},
"mapping": {
"analysis": {
"analyzers": {
"custom_unicode": {
"token_filters": [
"to_lower",
"edge_ngram_min_2_max_7"
],
"tokenizer": "unicode",
"type": "custom"
}
},
"token_filters": {
"edge_ngram_min_2_max_7": {
"back": "false",
"max": 7,
"min": 2,
"type": "edge_ngram"
}
}
},
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": false,
"enabled": true,
"properties": {
"name": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "custom_unicode",
"docvalues": true,
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "name",
"store": true,
"type": "text"
}
]
}
}
},
"default_type": "_default",
"docvalues_dynamic": true,
"index_dynamic": true,
"store_dynamic": false,
"type_field": "_type"
},
"store": {
"indexType": "scorch"
}
},
"sourceParams": {}
}