There are two obstacles, one or both are likely occurring.
Enable Contains Search might be disabled in Search Manager
Without it, you can only search for strings at the start of “words” (but here “words” means “indexed tokens”). Unfortunately switching this on will cause a performance penalty on all search pages system wide, so you might not want to enable it globally just for this use case.
Search Index logic
The other factor is that Search Pages don’t search the attribute/field in question, they search the indexed version of that attribute/field. Indexing logic is complicated but basically the problems are:
- Matrix breaks up strings and indexes “words” that are longer than the minimum (default 4)
- Domains are hard hit by this - “www.example.com” would get indexed only as “example”
- Matrix indexes email address differently to everything else
Same rules seem to apply to search queries, so when you search for “example.com” and expect it to match "user@example.com" you’re actually only searching for “example” and it’s trying to match against “userexamplecom” (which might work if you have Enable Contains Search switched on)
MacGyver time
Your best bet for influencing Matrix search indexing lies in using a metadata schema to provide a modified version of a given attribute.
You can create a dedicated Metadata Schema with a single Text Field called “Email” and set the default to %asset_attribute_email%
. Apply it to the Users you want to be searchable and change your search page from using the email attribute to this MD field.
Now that you’ve got essentially a copy of the email attribute in an MD field, you can use keyword modifiers to change how it gets indexed. Ideally you want "user@example.com" to be indexed as **just ** the domain. You can use a couple of ^replace
keywords to strip out user@
and all the dots from the domain
%asset_attribute_email^replace:\^.*@:^replace:\.:%
Regenerate the metadata schema and check the MD screen for your users and you’ll see the new “dotless domain” version for each user.
Now that you have “examplecom” in the search index, you just need to modify your Search Page to remove any dots prior to searching - i.e. if you want to search for example.com change it to “examplecom”.
Caveats
This isn’t perfect, because a search for “examplecom” will return matches like “examplecomau”. Ideally you could set the Search Page to only return exact matches, but I’m not sure that’s possible.