Wildcard matching

Relevanssi Premium 2.10.2 introduces new way to search: wildcard matching. Once the wildcard matching is enabled (it is disabled by default), it introduces two new operators: * and ?. Using the wildcard operators The * operator replaces zero or more characters, so searching for w*ess would match “wilderness”, “witness”, “WordPress”……“Keyword matching” setting is not set to “Whole words”, because wildcard matches are not whole word matches. Enabling wildcard matching In order to enable the wildcard matching, add a filter function that returns true to the relevanssi_wildcard_search filter hook, like this: add_filter( ‘relevanssi_wildcard_search’, ‘__return_true’ ); This one-liner, which you can……and also “wess”. The ? operator matches exactly one character, so searching for gr?y would match “grey” or “gray”, but not “gravy” or “groovy”. These operators only work within words. Searching for *ess or gra? will not have the expected results. The wildcard operators can only be used when the…

Filter hooks

…post IDs). This filter gives you a chance to examine and modify those restrictions before they are used. relevanssi_wildcard_search (boolean) (Since 2.10.2, Premium only) Add a function returning true to enable the wildcard operators (* and ?). Read more on wildcard matching. relevanssi_woocommerce_indexing (array) (Since 4.0.9 / 2.1.5) This can……filter can be used to modify the term WHERE condition part of the MySQL query. Relevanssi uses this internally to facilitate the wildcard matching. (Since 2.10.3 / 4.8.3) The filter hook gets the search term as the second parameter. relevanssi_update_options relevanssi_user_add_data ($user) (Premium only) Use this filter to add extra data…

Premium 2.10 / Free 4.8

…them (‘user_a, user_b’). This is now fixed for good, the earlier fix didn’t work. (Premium) Minor fix: When indexing, users are now counted in a different way, so that the relevanssi_user_indexing_args filter hook is applied and the count reflects the actual number of users indexed. 2.10.2 / 4.8.2 (Premium) Wildcard


…convenient. This new filter hook is for this very purpose: you can use this filter hook to add custom field names from code using the field_%_subfield notation and then have Relevanssi expand those wildcard field names to actual field names (which you can then filter with relevanssi_index_custom_fields if need be)….