Jump to content

Searching and repeaters


jacmaes
 Share

Recommended Posts

In the "search.php" template that comes with the download of PW, this line allows you to search for "title", "body" and "sidebar" fields:

$matches = $pages->find("title|body|sidebar~=$q, limit=50");

But how do you search for content inside a repeater field?

Thanks.

Link to comment
Share on other sites

  • 6 months later...

Is it possible to search for a certain file (using name of that file) added through File field in admin panel? Simply adding a name of the Field in search.php as is written above generates an error of course.

Can I perhaps retrive names of the files from the records stored in field_file table in DB put them into an array and then pass somehow into the $matches variable in search.php? Will it work with PW API?

Link to comment
Share on other sites

You can match in either the filename, description, or tags via any of the DB-find functions too. 

$pages->find("files=myfile.jpg"); 
$pages->find("files%=myfile"); 
$pages->find("files.description*=some text"); 
$pages->find("files.tags%=mytag");  

One thing to note is that description and tags have fulltext indexes, but the actual filename doesn't. As a result, if you need to perform a partial match on filename, you can only use the "%=" operator. 

  • Like 1
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...