cancel
Showing results for 
Search instead for 
Did you mean: 

Query for Custom Metadata

donalith
Champ in-the-making
Champ in-the-making
I've created a custom metadata tag called documentStamp and it keeps a text value.

If I search by @cm\:created: [date range] my result set contains 9 documents. Each of those documents has a documentStamp value.
For example:

name: "{http://www.mycompany.com/documentmanagementsystem/model/dictionary/0.9}documentStamp"
value: "00126354382"

But when I try to run:

Query query = new Query(Constants.QUERY_LANG_LUCENE, "@cm\\:documentStamp: \"00126354382\"" I get an empty result set.

What do I need to run to hit these custom metadata tags?
5 REPLIES 5

mitpatoliya
Star Collaborator
Star Collaborator
@cm need to be replaced by the @ followed by your prefix in your custom content model.
ex.  @custom
Also you need to specify the store in the searchparameter object you will be using later on to fire that query.

donalith
Champ in-the-making
Champ in-the-making
Thank you! That worked but I had to change the query language to FTS-Alfresco. I couldn't seem to get it to work in Lucene.

mitpatoliya
Star Collaborator
Star Collaborator
That should work for lucene as well.
have you tried your query in the node browser?

donalith
Champ in-the-making
Champ in-the-making
Thank you, yes, it DOES work in Lucene once I've modified the query to escape the characters necessary. I'm all set now.

Donalith

mitpatoliya
Star Collaborator
Star Collaborator
Please mark it as solved.