Jump to content

Site Search how to search a date


GeekMan
 Share

Recommended Posts

I really know nothing about ProcessWire, but my site, www.cji.edu, was created with it. On our home page we have a "Search" field. How do you search for a "Date" like "May 5"?

"May" by itself doesn't work (maybe it is to short).

"June" works by itself but not if you also have a number with it like "June 21".

Are there configuration changes that our WebSite Host can make to fix these situations?  Thanks.

Link to comment
Share on other sites

The default minimum length for words in a mySQL fulltext index is 4 letters, and while your hoster might be prepared to reduce that length for you, it would probably be better to change the way your search page works.

Assuming you have ftp access, look for /site/templates/search.php. Its contents probably aren't that much different to the basic install search template, based on the way it appears to work and output results. If that is indeed the case, then look for a line like line 24 in the file I linked above.

If it is identical, then replace the equivalent line with the following

$terms = explode(' ',$q);
$selector = '';
foreach($terms as $term){
    $selector .= "title|body%=$term, ";
}
$selector .= "limit=50";

and you should be good to go. (Touch wood.)

If it's very similar, you may be able to figure out what to change, but if not, post what code you have and we'll try to help.

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...