Jump to content

Search selector to compensate for apostrophe or dashes etc.


a-ok
 Share

Recommended Posts

Is it possible for a selector (for search results) to return a page if the title is 'Kettle's' but the search term is 'kettles'? I can't include 'name' in my fields to search (which would've worked) but then if someone searched 'Kettle's' for the page title 'Kettles' it wouldn't work.

Thoughts?

Link to comment
Share on other sites

Yeah tried them all.

$results = $pages->find("$fieldsToSearch%=$searchQuery, template=$templatesToSearch, sort=sort, check_access=0");

$resultsToRemove = new PageArray();
foreach ($results as $result) {
	if ($result->template->name == 'repeater_modulesA' && ($result->getForPage()->is('unpublished') || $result->getForPage()->is('trash'))) {
		$resultsToRemove->add($result);
	}
}
$results = $results->not($resultsToRemove);
Link to comment
Share on other sites

1 hour ago, kongondo said:

Why can't you?

It’s having a weird conflict with the multiple pageField.title in the selector. If I have one and name, it works fine, if I have multiple without name it works fine. If I have multiple AND name it throws an error referenced here: 

 

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...