Jump to content

Searching repeaters only works in Chrome strangely


Pablos
 Share

Recommended Posts

Hi all,

I'm using the following selector to search the title and keywords fields of all instances of a repeater across my site:

$matches = $pages->find("template=repeater_Images_With_Variations, title|keywords*=" . $search_term_string);

I've been developing using Chrome and everything's been working fine, but I just tested in  Safari, Firefox and IE and that same selector failed to find anything. I didn't know the browser could affect searches on the back end, but that seems to be what's happening.

Does anyone have any idea what's going on?

Thanks for any help,

Paul

Link to comment
Share on other sites

4 minutes ago, Pablos said:

I didn't know the browser could affect searches on the back end, but that seems to be what's happening.

The browser can't affect this :)

Are you sure it's not finding the matches? Is it possible there is some JS involved in displaying the matches that is failing?

The first thing I would do is confirm that $search_term_string is the same when working vs not - where does that come from?

Link to comment
Share on other sites

I know - I feel like an idiot suggesting it... :-[

I'm logging the number of matches from the php file in the very line below the $matches assignment and it's 3 in chrome and 0 in all the others.

The search term is coming from a search field via a jquery ajax call. It's definitely making reaching the php file and everything seems to be identical up to the point where the repeater search happens.

I'm actually performing a regular page search on the same search term before the repeater search and that's fine in all cases, which does seem to suggest it's the selector that's the prob.

Really weird!

Link to comment
Share on other sites

You may know this already, but just to explain the reason...

Guest users do not have direct access to repeater pages because they live under the Admin branch (guest users can only view repeater content via a repeater field).

One solution is to add "check_access=0" to the selector if it is definitely the repeater pages themselves you want to find.

Or instead you might want to find the pages that the repeater pages are contained within...

$container_pages = $pages->find("Images_With_Variations.title|Images_With_Variations.keywords*=" . $search_term_string);


 

  • Like 2
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

  • Recently Browsing   0 members

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