Search bodycopy containers/divs


#1

Matrix Version: 5.4.2.1

TL:DR does the search page properly support bodycopy containers as asset types to search?

My search field is Standard asset field: asset contents. Allow empty searches: Yes.
Asset types to search for: Bodycopy Container (inherit). Also tried with Bodycopy Div.

When I perform an empty search I get results returned, but when I try to search on a term, it always returns 0 results. Am I missing anything?

I figured asset_contents might not be available for a bodycopy div but when I use the keyword in the type format on an empty search, I get the contents.

Essentially we are trying to determine if, provided a tag/keyword, we can select parts of page contents and provide as a json array for consumption.
We could separate the bits of content that we want to capture as separate pages, tag with metadata, and nest them back where they were, but only if we have to. It’d be preferable to somehow target individual containers.


(John gill) #2

Search Page supports bodycopy containers, but “Asset Contents” are only indexed against the page that contains them.

You can confirm this if you’ve got a VM of the Matrix text image

  • Create a Standard Page (#835)
  • Put the word “Penguin” into the bodycopy (#837)
  • Add another bodycopy (#839), put the word “Giraffe” in it.
  • Open up postgresql and look for those words in the search index table

matrix=> select value, assetid, type_code, component from sq_sch_idx where value = 'penguin' or value = 'giraffe'; value | assetid | type_code | component ---------+---------+---------------+-------------- penguin | 835 | page_standard | __contents__ giraffe | 835 | page_standard | __contents__ (2 rows)

matrix=> select value, assetid, type_code, component from sq_sch_idx where assetid = '837'; value | assetid | type_code | component ---------------------+---------+--------------+-------------------- 2018-06-08 04:02:52 | 837 | bodycopy_div | __updated__ container1 | 837 | bodycopy_div | attr:name container1 | 837 | bodycopy_div | __short_name__ container1 | 837 | bodycopy_div | __name__ 837 | 837 | bodycopy_div | __assetid__ 2018-06-08 03:58:01 | 837 | bodycopy_div | __status_changed__ 2018-06-08 03:58:01 | 837 | bodycopy_div | __created__ (7 rows)

bodycopy_div assets do get some search fields, but not their contents.


#3

Alright, I’ll explore other options. Thanks.