I have a module that creates a custom content entity for staff members and a search page for the entity. The current search module uses an advanced search with fields that can use exact matches, but the default search box should allow for partial matches. I looked at the Porterstemmer module, but that appears to be designed for general text searches rather than personal names. Creating a similar module for names would require far more complexity than this search needs, as does adding the search api/solr modules. I have tried passing the keywords in with wildcards as well as using hook_search_preprocess. Is it possible to add wildcards in the condition object for this search or is there a better way to accomplish this?
Here is the relevant part of the object:
[conditions:protected] => Drupal\Core\Database\Query\Condition Object ( [conditions:protected] => Array ( [#conjunction] => AND  => Array ( [field] => d.data [value] => % username % [operator] => LIKE ) ) [arguments:protected] => Array ( ) [changed:protected] => 1 [queryPlaceholderIdentifier:protected] => [stringVersion:protected] => )
Where ‘% username %’, as the should be ‘% %username% %’ to match “word (username1|username2|*username*) word” rather than only “word username word” in the search-dataset table. This object is in a Drupal\search\SearchQuery Object within a Drupal\Core\Database\Query\PagerSelectExtender object.