Jump to content

Recommended Posts

Posted

Hi,
I'm having problems with seatching for a value in repeater.
One of pages have attached repeater called 'insight_repeater'.
This repeater has h1_tag (text field) and i'm trying to search for repeater items that contains 'lor' phrase.

And right now i'm trying to do simple search, looking for phrase 'lor'. I've tried many approaches, but nothins seems to work, so i want to ask what i'm doing wrong here:

<?php $query = $page->get("insight_repeater")->find('h1_tag~=Lor'); ?>

Thanks for help.
 

Posted
3 minutes ago, kixe said:

Hi @kixe !

Thanks for fast reply, but what is the difference between those two as both uses $pages ? (not $page and $pages).
get() will get repeater from current page, and find() will search in whole project ?
Cheers.

 

Posted

I've just checked this.
first case returns:
noticee: trying to get property on non object in...

and the second returns nothing ...
I'm using latests dev version.

Cheers.

Recently, i see that my code is actually working, but if h1_tag contains "Lorem" i'm only able to make this work if i'll type:

<?php $query = $page->get("insight_repeater")->find('h1_tag~=Lorem'); ?> and not Lor. Is there any workaround ?

Posted

One strange thing is:

This page, that containes insight_repeater also have h1_tag, and this query will return page's h1_tag instead of repeater's h1_tag:


 

<?php $query = $pages->find("insight_repeater.h1_tag~=Lorem"); ?>

 

Posted
3 hours ago, activestate said:

<?php $query = $page->get("insight_repeater")->find('h1_tag~=Lorem'); ?> and not Lor. Is there any workaround ?

Welcome to the forums @activestate

Have a read here about selectors, specifically about MySQL and short words.

Quote

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).

 

Please use code blocks (@see the <> icon) around your code.

  • Like 3
  • Thanks 1

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
×
×
  • Create New...