Skip to content

Instantly share code, notes, and snippets.

@jreviews
Created November 16, 2019 11:21
Show Gist options
  • Save jreviews/cbd64b703c12093d41240ad344afb242 to your computer and use it in GitHub Desktop.
Save jreviews/cbd64b703c12093d41240ad344afb242 to your computer and use it in GitHub Desktop.
JReviews Developer Filter: Change the minimum word length requirement for searches
<?php
defined('MVC_FRAMEWORK') or die;
/**
* Change the minimum word length requirement for a word to be included in a keyword search
*/
function listing_search_minimum_characters($request, $params)
{
ListingsRepositoryComponent::$min_word_chars = 2;
return $request;
}
Clickfwd\Hook\Filter::add('before_filter_request_categories_search', 'listing_search_minimum_characters', 10);
Clickfwd\Hook\Filter::add('before_filter_request_categories_liveSearch', 'listing_search_minimum_characters', 10);
Clickfwd\Hook\Filter::add('before_filter_request_categories_liveFilter', 'listing_search_minimum_characters', 10);
@jreviews
Copy link
Author

jreviews commented Nov 16, 2019

To use this filter:

  1. Upload the above file to jreviews_overrides/filters
  2. Add the line below to jreviews_overrides/filter_functions.php, if you are not using filters yet, read the documentation on Getting Started with JReviews developer filters

require_once "listing_search_minimum_characters.php";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment