Implementing Case-Insensitive Searching
About this task
By
default, searches for custom task fields are case-sensitive. For
example, a search for the term Order
will
return different results than a search for order
. If you have
a task application that requires case-insensitive searches, a public
API method (caseInsensitive
)
is available to enable individual custom search fields to provide
case-insensitive behavior.
Note: Prior to carrying out the following
procedure, you must first create your task application as described
in Creating a New Task with the Task Wizard, and then add custom
search fields to it as described in Creating Custom Search Fields from Task Business Data.
You must carry out this procedure for each field that requires case-insensitive behavior.
To define a field as case-insensitive
Procedure
Alternative Approach
As an alternative to the method above, you can modify the task search provider Java file, as follows:
- Open
the task search provider Java file in the editor. For example:
com.webmethods.caf.<taskName>_inboxresults > <taskName>_SearchProvider.java
- Add
<fieldName>.setCaseInsensitive(true);
to theget
action for the field you want to apply case-insensitive behavior to. For example, if you are working with the fieldFirstName
:public com.webmethods.caf.faces.data.task.impl.TaskSearchQueryTerm getFirstName() { if (FirstName == null) { FirstName = new com.webmethods.caf.faces.data.task.impl.TaskSearchQueryTerm(); FirstName.setCaseInsensitive(true); } return errorMessage; }
- Save the file.