jacmaes Posted September 25, 2012 Share Posted September 25, 2012 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 More sharing options...
nik Posted September 25, 2012 Share Posted September 25, 2012 It's possible to use <repeater-name>.<field-in-repeater> as a field name. For example: $matches = $pages->find("title|my_repeater.my_field~=$q"); 8 Link to comment Share on other sites More sharing options...
jacmaes Posted September 25, 2012 Author Share Posted September 25, 2012 Thanks, Nik! I wasn't sure on the syntax. As usual, it's easier than anticipated. Link to comment Share on other sites More sharing options...
mike77 Posted April 9, 2013 Share Posted April 9, 2013 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 More sharing options...
DaveP Posted April 9, 2013 Share Posted April 9, 2013 $contracts = $page->files->find('description*=Contract'); $catlist = $page->files->get('description*=Cat List'); Are a couple of lines from an actual intranet app we use at work. 1 Link to comment Share on other sites More sharing options...
ryan Posted April 11, 2013 Share Posted April 11, 2013 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. 1 Link to comment Share on other sites More sharing options...
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