Alex Posted May 27, 2013 Posted May 27, 2013 Hi, I am using the basic search template from the processwire install. I havn't been able to return any search results from text contained in repeater fields. I have added the repeater field name and all fields contained inside it to my search template. On processwire.com i have found this post in the comments area by someone: It should be noted that a search will not yield any hits from repeaterfields. I guess that is because the content actually belongs to a hiddenpage. Is there any way around this, or are repeaters left out of search results? thanks Alex
slkwrm Posted May 27, 2013 Posted May 27, 2013 Hi, Alex. I think that the following code should work: $found = $pages->find('myrepeater.summary*=hello'); Maybe you should try this: $found = $pages->find('myrepeater.summary*=hello, include=all'); But then it doesnt check access rights and published/unpublished state of your pages. Maybe you should post your code here so others can see it. 1
doolak Posted May 27, 2013 Posted May 27, 2013 Hi there, I ran encountered exactly the same problem a few minutes before - now I had a look at the original search template: $matches = $pages->find("title|body|sidebar~=$q, limit=50"); Does this mean that the selectors above overwrite the module settings? Cheers, Christian
doolak Posted May 27, 2013 Posted May 27, 2013 In fact it's a little confusing: In the module settings you can define the default fields to search and the default field names which should be displayed in the results. In the search template both parameters are defined again - do the module settings make any sense then?
slkwrm Posted May 27, 2013 Posted May 27, 2013 Hi, Doolak. I think there's some confusion going on Search module (ProcessPageSearch)is purposed solely for back-end usage: it runs when you hit search in the admin interface (and you get to the back-end search page whare you can see the default settings you mentioned). The default settings of this module don't affect your template code, they are totally independent. Your selector, access rights and page status are three things that define the results you get when you search via api. It seems though, there's no way to search repeater fields with ProcessPageSearch at the moment. Correct me if I'm missing something. 1
doolak Posted May 27, 2013 Posted May 27, 2013 Hi slkwrm, yes - recognized that mistake - just found the description of the module: "Provices a page search engine for admin use." ... Searching repeater fields through the API seems to work fine here the way you described it, thanks a lot! $matches = $pages->find('myrepeater.myrepeaterfield*=$q');
Alex Posted May 27, 2013 Author Posted May 27, 2013 Thanks Slkwrm & Doolak $matches = $pages->find('myrepeater.myrepeaterfield*=$q'); Works for me too. Cheers
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