FTS alphanumeric data is not searched

My field Postalcode / Address has value like
Postal Code : 4236789
Address : NJ00723

Type Text only .

When i search as any numeric part for e.g. 67 or 007 its not giving result.

Would you share the FTS index definition you’ve set up.

thanks for quick response


“postalCode”: {
“enabled”: true,
“dynamic”: false,
“fields”: [
{
“analyzer”: “inherit”,
“include_in_all”: true,
“include_term_vectors”: true,
“index”: true,
“name”: “postalCode”,
“store”: true,
“type”: “text”
}
]
},

Are you looking for complete index ?

Based on the snippet of the index definition you’ve shared, I’ll assume you’re using the default analyzer as you haven’t set anything specific for postal code, which is the standard analyzer.

Firstly, you gotta make sure that postalCode’s value is indeed a text in your document JSON and not numeric.

Once you’ve confirmed it is indeed of text type - the standard analyzer indexes the postalCode string as is - 4236789
So what’s searchable is “4236789” or a wildcard/regexp search as “.*67.*”.

Here’s documentation on analyzers -
https://docs.couchbase.com/server/6.6/fts/fts-using-analyzers.html

If you want “67” to be searchable within the string “4236789”, I’d look into defining an ngram token filter and setting up and using a custom analyzer with it.

Test the behavior of analyzers or if you were to design a custom analyzer here - Bleve Text Analysis Wizard

Here’s a blog on how to build custom analyzers …