cancel
Showing results for 
Search instead for 
Did you mean: 

Does alfresco explorer supporting the tag based search??

mialfresco
Champ in-the-making
Champ in-the-making
Hi team,
I'm using alfresco labs stable 3.0 version.
And i have given a tag to one of my document through alfresco explorer.
And i tried to search for document using advanced search.

i'm facing the following problems.
1) i have given the tag name in the search box it is not searching any content that means it is not showing the files with that tag.
2) i have selected the tags category and checked "include sub category" then try to give like *.* (or *.docx)  then also it is not showing any document. (actually i have given some tags to the documents).

Does alfresco explorer supporting the tag based searching ?
if, can anyone tell me how to search using the tags.
4 REPLIES 4

jpotts
World-Class Innovator
World-Class Innovator
I could be wrong, but I don't think you'll be able to get what you want from the OOTB advanced search UI.

If you want to do some sort of customization, the Lucene syntax for searching for all documents with a given tag is:

PATH:"/cm:taggable/cm:[tag]/member"

where [tag] is an encoded tag. So, to find everything tagged with "alfresco" you'd use:

PATH:"/cm:taggable/cm:alfresco/member"

and to find everything tagged with "hot tamales" you'd use:

PATH:"/cm:taggable/cm:hot_x0020_tamales/member"

You can use org.alfresco.util.ISO9075.encode() to encode your string appropriately.

If you can't/don't want to use Lucene directly, you could use one of the many tag-related web scripts. In 3.1 Enterprise there is a "Tagging" family of web scripts. I can't remember if they are categorized in Labs or not. You can always search the URI list of web scripts for "tag" to find them.

So long story, short, I think doing a tag search from the web client is going to require some code.

Jeff

mialfresco
Champ in-the-making
Champ in-the-making
Hi Jeff,
Thanks for your reply.
I got the thing exactly but a bit confusion. As i'm new to alfresco.
Can you suggest me which files i need to make changes to do tag based search.
do i need to add the syntax which you send in any of webscripts?
or i need to change the source code of alfresco?

regards,
John

jpotts
World-Class Innovator
World-Class Innovator
If you want to add tag search to the existing advanced search page, you're going to have to extend that page and maybe some related files. Exactly which files to change is beyond the scope of what I can cover in a forum post. The best advice I could give would be to learn about customizing the Alfresco web client and follow those examples. You should be able to do this without touching Alfresco source. My post assumed that's what you wanted to do, and what I provided was the Lucene syntax you'd need to format a Lucene search query that would return the tagged documents.

If what you want to do is search for tagged documents from a web script, it's easier because there are already API calls for doing tag-based searches. In fact, there are already web scripts for searching for tags, tagged nodes, and for adding tags:

Get nodes for tag
GET /alfresco/service/api/tags/{store_type}/{store_id}/{tag}/nodes

Get Node Tags
GET /alfresco/service/api/node/{store_type}/{store_id}/{id}/tags
GET /alfresco/service/api/path/{store_type}/{store_id}/{id}/tags

List all tags
GET /alfresco/service/api/tags/{store_type}/{store_id}?tf={tag_filter?}

Add tag
POST /alfresco/service/api/node/{store_type}/{store_id}/{id}/tags
POST /alfresco/service/api/path/{store_type}/{store_id}/{id}/tags

This is the list from 3.1 Enterprise and you can get to it by going to http://localhost:8080/alfresco/service/index/family/Tagging. I don't recall off-hand whether or not Labs 3 Stable has the web scripts organized by family or not, but you can always go in to http://localhost:8080/alfresco/service/index/uri/ and search for "tag".

So using the example from my last post, to find the nodes tagged with "hot tamales" you'd make an HTTP GET to:
http://localhost:8080/alfresco/service/api/tags/workspace/spacesstore/hot%20tamales/nodes

which will return JSON with the results.

If those web scripts don't do what you need, you can look at the code to see how they work and then steal those ideas for your own web scripts.

For example, if you go to http://localhost:8080/alfresco/service/script/org/alfresco/repository/tagging/tags.nodes.get you'll see the source code for that web script and you'll see the JavaScript API call that finds the tagged nodes:

model.nodes = search.tagSearch(store, tag);

Hope that helps,

Jeff

mialfresco
Champ in-the-making
Champ in-the-making
Hi Jeff,
Thanks for your help. It is helping me.

Thanks again for your support.

Regards,
John