Nested search page - using keyword replacement


(Mahearnpad) #1

Hi

 

I am using a nested search page to list asset names based on a stored search query, which is the value of a metadata field.

 

This is working OK. But now I want to print the value of a metadata field for each result.

 

Can't use a search term, as I want the actual value of the found asset's metadata field. Using a keyword replacement for %asset_metadata_<fieldname>% does not work.

 

I cannot find how to do this. Is it actually possible?

 

Thanks


(Peter McLeod) #2

Hi

 

Do you mean that in your search result type format, rather than the %asset_name% - you want the print the %asset_metadata_<fieldname>% value instead - but the metadata value doesn't get output?

 

Thanks

Peter


(Mahearnpad) #3

Hi Peter

 

Yes, that's exactly what is happening. Seems the keyword replacement is not available on the result type format. Do you know the solution to this, if any?


(Peter McLeod) #4

It should work ok, we use use them on result type formats a lot:

 

Maybe check:

  • your fieldname is correct (spelling/case) in the format
  • is it getting cached - either server or client side

As your assets are getting returned in the results then the following probably wont apply:

  • if its a recent schema change - might need to regenerate it
  • also if metadata was added recently check indexing is on - we had an issue where is was off after a recent upgrade and couldnt work out why assets werent get found

What type of metadata field is it?

 

Thanks

Peter


(Mahearnpad) #5

I doubt whether caching is a problem, but I'll check. Spelling - yes I've checked that carefully, as it's often where things fall down.

 

Do you need to explicitly pass in the asset's metadata field to the search asset?  I've tried this too, but there doesn't seem to be a way to pass in a variable (that is, it needs a particular term rather than a keyword replacement).

 

Oh, and the metadata field is just a text field, with a string value.

 

I know that the metadata fields are available on the assets, because I'm using one of them (not the same one) to filter the results in the search asset.

 

 

thanks 


(Anthony Ponomarenko) #6

Hi Michael,

 

Try using the nested_ keyword prefix 

 

eg%nested_asset_metadata_XXXXX%

 

https://matrix-manuals.squiz.net/content-types/chapters/nest-content 


(Mahearnpad) #7

Thanks for your suggestion, Anthony.

 

I ended up changing the way I implemented this, so didn't get a chance to see if your suggestion worked. But I'll keep it in mind for future.

 

thanks


(Ravi) #8

Hi There,

 

I wanted to know how we display the search form and results displays on the same page? now, it is linking to the new page and display the results.


(Anthony Ponomarenko) #9

Hi Marin,

 

You can include what you have in your Initial Search Page Layout on the Results Page Layout by adding the %initial_layout% keyword.


(Ravi) #10

Thanks Pono. Apologies for the late reply.


(Anthony Ponomarenko) #11

All good :slight_smile: