Tyssen Posted January 31, 2016 Posted January 31, 2016 I've implemented a site search on a site and am a bit confused about how it processes results. For instance, a search for art union produces no results, same for a search for art, but a search for union produces 5 results including the one I was hoping would come up which has a title of art union. How/why is that happening and is there anything to configure to improve the results? My search form looks like: <form action="<?php echo $pages->get("template=search")->url; ?>" method="get"> <input type="text" name="q"> <button type="submit">Search</button> </form> and the search template: if($q = $sanitizer->selectorValue($input->get->q)) : $input->whitelist('q', $q); $matches = $pages->find("title|body|summary~=$q,template!=admin, limit=50"); $count = count($matches); if($count) : foreach($matches as $m) : … endforeach; endif; else: … endif;
BitPoet Posted January 31, 2016 Posted January 31, 2016 This is documented behavior. From PW's selector documentation: The *= and ~= rely upon MySQL fulltext indexes, which only index words of at least a certain length (configurable, but typically 4 characters). They also don't index common English words called stopwords. So while it's preferable to use *= and ~= for their speed, if you aren't getting the results you need, you should consider using %= instead (if you can handle the speed hit). 1
LostKobrakai Posted January 31, 2016 Posted January 31, 2016 It's also been improved on pw 3.0 https://processwire.com/blog/posts/merry-christmas-heres-processwire-3.0.3-and-2.7.3-and-some-more/
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now