LIKE Terms

Current version: 2.4.6 View Changelog

Download available with active license

⚠️ Note: This extension is DEPRECATED as of SearchWP version 3.0 and will be removed soon ⚠️

Unlike Fuzzy Matches, LIKE Terms does not perform primitive spell checking at all. This is useful if you’re looking to allow partial matching of terms, without exposing close spelling variants which can cause performance issues in the wrong circumstances.

For example, you should use LIKE Terms instead of Fuzzy Matches if you’re looking to incorporate SKU searching and want to allow for partial term matches without exposing thousands of similarly “spelled” SKUs that would be included with Fuzzy Matches.

Filters

There are a number of filters to help with your LIKE Terms implementation:

searchwp_like_min_length
Customize the minimum length of a word for LIKE matching to be applied. Default is 4, to customize:

<?php
// Apply LIKE matching for terms 2 or more characters in length.
function searchwp_like_min_length( $length ) {
return 2;
}
add_filter( 'searchwp_like_min_length', 'my_searchwp_like_min_length' );
view raw functions.php hosted with ❤ by GitHub

searchwp_like_stem
Customize whether SearchWP applies LIKE matching to the keyword stem regardless of engine setting. Default is false, to customize:

<?php
// Control whether SearchWP uses the keyword stem when finding LIKE terms.
function my_searchwp_like_stem( $stem, $terms, $engine ) {
// Return true/false (default is false)
}
add_filter( 'searchwp_like_stem', 'my_searchwp_like_stem', 10, 3 )
view raw functions.php hosted with ❤ by GitHub

searchwp_like_wildcard_before
Customize whether SearchWP implements a LIKE wildcard before search terms. Default is true, to disable:

<?php
// Prevent SearchWP LIKE Terms from using a LIKE wildcard before search terms
add_filter( 'searchwp_like_wildcard_before', '__return_false' );
view raw functions.php hosted with ❤ by GitHub

searchwp_like_wildcard_after
Customize whether SearchWP implements a LIKE wildcard after search terms. Default is true, to disable:

<?php
// Prevent SearchWP LIKE Terms from using a LIKE wildcard after search terms.
add_filter( 'searchwp_like_wildcard_after', '__return_false' );
view raw functions.php hosted with ❤ by GitHub

Changelog

2.4.6

  • [Fix] Fixes PHP Warning

2.4.5

  • [Fix] Better handling of minimum character count
  • [New] New filter searchwp_like_wildcard_before allows control over partial matching before terms (default is true)
  • [New] New filter searchwp_like_wildcard_after allows control over partial matching after terms (default is true)
  • [Update] Updated updater

2.4.4

  • [Fix] Fixed an issue that prevented exclusive regex matches from being properly restricted

2.4.3

  • [Fix] Fixed a regression introduced in 2.4.2

2.4.2

  • [Fix] Fixed an issue with multiple terms
  • [Update] Updated updater

2.4.1

  • [Fix] Better stemming support

2.4

  • [New] New filter searchwp_like_stem allows developers to restrict LIKE matches to the term(s) (as opposed to term(s) and stem(s))
  • [Improvement] Support for automatic updates based on your SearchWP license key

2.1

  • [Change] Also use keyword stems to find LIKE terms

2.0

  • [Change] No longer force-disable AND logic
  • [Change] Updated to the new filter structure

1.0

  • Initial release

A Better WordPress Search Experience

Get the best WordPress search plugin. Trusted by 50,000+ websites.

Get SearchWP Now
Multiple Search Engines Icon