cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching documents with some specified metadata value

bichi59
Champ in-the-making
Champ in-the-making
Hi Alfresco-techies,

i am new to Alfresco. Hence my query may seem to be very basic.
My requirement is to fetch all the documents in a specific alfresco space ( and subspaces) whose metadata value satisfies certain desired value. ex. if document has documnetCreatedFor metadata/attribute and we want to retrieve the documents with documnetCreatedFor value as "Reference-Doc".

Can you let me know the process and query details ?
4 REPLIES 4

billerby
Champ on-the-rise
Champ on-the-rise
This is an example of a lucene query that achieves what you want starting in space "company home", this one is written for the javascripting environment:


var nodes = search.luceneSearch("+PATH:\"/app:company_home//*\" +@my\\:documentCreatedFor:\"Reference-Doc\"");
for each(var node in nodes) {
  logger.log(node.name + " (" + node.typeShort + "): ");
}

You have to replace the short namespace with your dito (the "my").

The "//*" in the end of the Path expression instructs lucene to also look in subspaces. You should probably include a +ASPECT or +TYPE as well to reduce the search base.

Regards
/Erik

bichi59
Champ in-the-making
Champ in-the-making
Thanks Erik.

shailu12
Champ in-the-making
Champ in-the-making
Hi Techies,
            I want to add some custom metadata to epub files in Stored in Alfresco and want to fetch it using APIS, could any body suggest me a way to it,

kaynezhang
World-Class Innovator
World-Class Innovator
You can use cmis api.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.