Tag/Category Dynamic Asset Listing


(Tbaatar) #1

**Matrix Version:5.4.3.1

I’m trying to create dynamic asset listing based on Current Page asset ID to list all posts which has current page asset ID in a metadata to create category/tag of similar topic items… You could look at it bit like Wordpress Categorisation. (i know link type is better approach but this is another story).

Here is an example:

Category
Category A (assetid: 1)
Category B (assetid: 2)
Category C (assetid: 3)

Posts
Post 1 (category A assetid, Category B assetid)
Post 2 (category A assetid)
Post 3 (category C assetid)

The expected output.
So if the user visits:
Category A page, it should display Post 1 & Post 2.
Category B page, it should display Post 1
Category C page, it should display Post 3


It seems like a very simple thing to do but I can’t get it to work with Asset Listing or Search Listing. Infact search listing fails to search comma seperated assetid’s

Any hint or pointers much appreciated.


(John gill) #2

A Text Field with comma delimited asset IDs won’t get indexed separately, but semicolon delimited will. Also a Related Asset Field with multiple selections, or a Text Field with field type set to “Multiple text fields” will be indexed separately.

(Search Manager is probably set up to only index “words” 4 characters and over, so any low asset IDs won’t get indexed. If you’re only dealing with asset IDs over 1,000 then it should be ok).

That doesn’t totally fix the problem though, because a Search Page with a Search Field set up to search a Metadata Field will return partial matches - a search for 123 will return any pages that contain 1234 in that field as well as real 123 matches. As far as I know, there’s no good solution to this other than manually culling these mismatches with JS (you could probably do it in SSJS rather than client side).