Create a Custom Character Filter
- Capella Operational
- how-to
Create a custom character filter with the Couchbase Capella UI to remove unwanted characters from a Search query or the contents of a Search index.
Prerequisites
-
You have the Search Service enabled on a node in your operational cluster. For more information about how to change Services on your operational cluster, see Modify a Paid Cluster.
-
You have logged in to the Couchbase Capella UI.
-
You have started to create or already created an index in Advanced Mode Editing.
-
You have already created or started to create a custom analyzer in your Search index.
Procedure
To create a custom character filter with the Capella UI in Advanced Mode:
-
On the Operational Clusters page, select the operational cluster where you want to work with the Search Service.
-
Go to
. -
Do one of the following:
-
To work with an existing Search index, click the name of the index where you want to create a custom character filter.
-
To create a new Search index, click Create Search Index.
-
-
Make sure to select Enable Advanced Options.
-
Expand Global Index Settings.
-
Do one of the following:
-
To create a new custom analyzer with a new character filter, click Add Custom Analyzer.
-
To add a new custom character filter to use with an existing analyzer, expand the Default Analyzer list, and next to your custom analyzer, click Edit.
-
-
Click Add Custom Character Filter.
-
In the Character Filter Name field, enter a name for the character filter.
The Search Service supports only the regexp Type for character filters. -
In the Regular Expression field, enter the regular expression for the character filter.
Any analyzer that uses your character filter will remove any characters that match the regular expression from token results.
For example, if you wanted to remove numeric characters from your tokens, you could use
[0-9]
as your regular expression. -
(Optional) In the Replacement field, enter a string that replaces any matches for the regular expression.
-
Click Add Custom Character Filter.
Next Steps
After you create a custom character filter, you can use it with a custom analyzer.
To continue customizing your Search index, you can also:
To run a search and test the contents of your Search index, see Run A Simple Search with the Capella UI.