I'm using Search API and Search Views to search the Drupal user database.

One of the fields is phone number where users are able to enter free text.

I can include this field in the search, but the search will not pick up part words.

E.g. 6162 5555 - does not display when I search for 25555 because the index sees these terms as separate words.

Is there a way to strip all the site space (and maybe then brackets) from the field before it is indexed by Search API?


2 Answers 2


I would use Computed Fields. Store and display user input with spaces, but index and search computed field too.

These computed fields are populated with values that you define via PHP code.

So you can simply remove white spaces, or re-format phone number in any way you please, and store a standardised copy of user's phone number. That way both representations will be searchable.

As a small bonus, other modules (like Views, various exporters and connectors or phone integration) would be able to benefit from this too. Bad thing is a slight overhead on reads and saves.


enter image description here

You need to disable Tokenizer. Then it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.