Jump to content

PageTable and search


Torsten Baldes
 Share

Recommended Posts

Hi!

I'm about to build a website with ProcessWire and I intend to use PageTable for a lot of custom page content.

The site also needs a search function and i wanted to know, if it is possible to search for something, which is mentioned on in a PageTable site and get the page containing this PageTable as result.

Is this possible (I hope so!) and how do i do something like this?

Thanks!

Link to comment
Share on other sites

thanks for your answer, but this doesn't meet my needs.

i think i found the right approach: 

$matches = $pages->find("title|keywords|description|pagetable.headline|pagetable.text|pagetable.images%=$q, template=products");

do you guys think, this is the right approach?

is it possible to search all subfields in a PageTable without declaring every field? something like:

pagetable.*

and another question:

if i have a repeater or a table field in a pagetable, can i just add another level to the field?

something like: pagetable.repeater.subsubfield ?

thanks!

Link to comment
Share on other sites

@apeisa

thanks for the hint with the cache fieldtype! my brain hurts from all the possibilities …  :wacko:

some questions for better understanding:

do i add all fields, regardless of wether they are used on the page or a containing pagetable?

do i also add the pagetable field to the list?

and last but not least, in where do i put (which template) this new cache field, i created?

Link to comment
Share on other sites

You would need cache field per template. If your "parent" template and PageTable template has same searchable fields, then you would be good with one cache field. Although I am not sure if one field would go in either way (if it just skips the fields that are not interested template then one field works).

Anyway, both of your templates need cache field attached, selector could be something like "(cachefield%=$q), (PageTable.cachefield%=$q)".

Parenthesis make it Or selector, so it would be enough either of selectors match, no need for both to match.

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

Antti - thanks for suggesting the cache field option here, but it still feels a little clunky to me. Seems to me that if I add a PageTable field that has a body subfield, and my site search selector includes the body field as a field to search, then PW should return pages that contain a PageTable field with a matching body subfield automatically. I think the current situation will catch people out and their search system won't work as expected. Maybe it's just me?

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