List Assets Created by Keyword


(Nick Papadatos) #1

Matrix Version: 5.5.4

Hi squiz folk - I’m trying to list all assets created by a specific user with when logged in with a nested search asset. I kind of have it working but noticed in the list I have 1 that wasn’t created by me so I’m wondering A: Is this possible and B: is my setup incorrect.

What I have:
A standard page which acts as the front end display nesting the search asset.

Search asset:
Search fields > author > data sources: Include all > word logic: All words
Stored query location: Search Field: author > set value: %globals_user_name%

So in theory the search should return assets based on name? I’ve tried %asset_created_by_ email, name, assetid but I’m still not getting the same results. If I change the word logic to any words I get ones that I created as a test but doesn’t explain why I’m getting some that I created in the past and getting some that I haven’t created.

Apologies for the wordy explanation but am hoping someone can help!

BTW - I originally had standard pages with the metadata values of the authors name which worked but am trying to minimise the workload by having one asset doing the work of potentially 10 or more…

Cheers
NickyP


(Nick Papadatos) #2

Update:
So I decided to try an asset listing page which works if I use the following condition in the default format:

     %begin_asset_created_by_name^eq:{globals_user_name}%
        markup
     %end_asset%

Now I’m finding the asset count is out of wack - shows the total assets. Is there a keyword modifier to the %asset_count% based on the assets created by the user? (that’s where the search asset is great)


(Bart Banda) #3

Def still try and use a search page, as an asset listing would be intensive as it has to load all other assets that weren’t created by you.

Is your search manager set to use “Enable Contains Search”? If so, maybe you are getting results other than yours because other people’s names start with the same string?

You could try and search for 2 values, for example user asset ID and Username and make the search page match logic match on ALL fields?


(Nick Papadatos) #4

Agreed Bart about search vs Asset listing - I did it more for testing the keywords across both assets.
Can confirm, search manager is set to “Enable Contains Search”

Two values like so? details screen > set value > %globals_user_name^as_asset:{user_asset_id}%
Any assistance is welcomed - am pulling my hair out…

Cheers
Nick


(Bart Banda) #5

I was thinking more like this:

Then on the frontend, you simply search for asset id of the user in one field, and the user’s asset ID in the other.

Does that help?


(Nick Papadatos) #6

Oh ok, got it - I don’t have User available in the Asset Attribute details dropdown. In fact, I only have standard page available
Matrix version 5.5.4

Update sorry I didn’t realise had to include User in the asset types to search for as well as standard pages


(Bart Banda) #7

Ah, sorry, I got confused, yes off course, you can’t add the user’s username as a field then if you are searching for Standard Pages (doh!)

So what you need to then do, is to create a metadata text field that has %asset_created_by_assetid% as the default value, can also make it non-editable. Then use that as the field to search on in the search fields.


(Nick Papadatos) #8

Ok, starting to make sense but but I was hoping that all the user has to do (private not public facing) is to navigate to mysite.com.au/admin/my-dashboard so when they login then Matrix knows who the user is and just pre populates the list based asset created by that particular user without having to do a search. so I need to set the values in the stored query locations?


(Bart Banda) #9

Yeah, so you need to set the details screen of the search page, stored search parameter and enable
Show the Results page:


(Nick Papadatos) #10

Cool! making more and more sense now thanks Bart - cant wait to give that a go. I’ll let you know how I go :slight_smile:


(Nick Papadatos) #11

Thanks Bart - so I’m pretty sure this is now working (I just need others to test) in that I’m seeing assets based on what I have created.

Do I still need username and assetid in the field configuration as suggetsed?
This is what I have and let me know if its correct?

The metadata field has %asset_created_by_assetid% which is non-editable. Asset types to search for is still just standard pages.

Thanks again
NickyP


(Bart Banda) #12

Nah, you don’t need it. What you have there should be enough.

The only thing to consider is the unlikely case of 2 users having the same starting asset ID. For example:
1234
12345

With “Enable Contains Search” on, this would make the search pick up pages by both those users.

The fix for this is to change the metadata field to be something like “X%asset_created_by_assetid%X” and then your stored search value be “X%globals_user_assetid%X”.

Glad you got the basics working though! :slight_smile: