How to search for tags by value

cancel
Showing results for 
Search instead for 
Did you mean: 
bip1989
Established Member

How to search for tags by value

Jump to solution

Hello community 

I am creating a custom search WebScript to support content personalized search. I am not able to find how to handle search for tags. When I checked the ootb search it seems tags are actually node refs and when search is happening it is using node  refs. 
how do i get the node ref from the tag value so i can try to follow same ootb search pattern or is there a way to implement search with value itself? 

i am using SearchService for my custom search

 

Any pointers will be helpful, thanks.

 

1 Solution

Accepted Solutions
abhinavmishra14
Advanced

Re: How to search for tags by value

Jump to solution

Have you looked at TaggingService

https://docs.alfresco.com/5.2/references/API-JS-TaggingService.html

https://docs.alfresco.com/5.2/references/dev-services-tagging.html

It has a method :

org.alfresco.service.cmr.repository.NodeRef getTagNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef, String tag)

 https://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/tagging/TaggingService.html#get...

When you pass the tag value to this method it returns the noderef which can be appened to search query. 

e.g.:

taggingService.getTagNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, inputTagValue);

where inputTagValue is the value you will pass for a tag that you are trying to search.
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View solution in original post

4 Replies
abhinavmishra14
Advanced

Re: How to search for tags by value

Jump to solution

Have you looked at TaggingService

https://docs.alfresco.com/5.2/references/API-JS-TaggingService.html

https://docs.alfresco.com/5.2/references/dev-services-tagging.html

It has a method :

org.alfresco.service.cmr.repository.NodeRef getTagNodeRef(org.alfresco.service.cmr.repository.StoreRef storeRef, String tag)

 https://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/tagging/TaggingService.html#get...

When you pass the tag value to this method it returns the noderef which can be appened to search query. 

e.g.:

taggingService.getTagNodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, inputTagValue);

where inputTagValue is the value you will pass for a tag that you are trying to search.
~Abhinav
(ACSCE, AWS SAA, Azure Admin)
bip1989
Established Member

Re: How to search for tags by value

Jump to solution

Thank you @abhinavmishra14, it worked for me. I was able to get noderef from text value and then added in search processing and getting results

EddieMay
Alfresco Employee

Re: How to search for tags by value

Jump to solution

Hi @bip1989,

Thanks for accepting the solution and updating us - really useful to other users. Thanks @abhinavmishra14 too for providing the solution.

Take care, 

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
bip1989
Established Member

Re: How to search for tags by value

Jump to solution

Thanks for help @EddieMay