Hello Community,
I'm trying to implement searching of files based on the properties of the content model of the document.
I found this ReST API:
GET /alfresco/s/slingshot/search?term={term?}&tag={tag?}&site={site?}&container={container?}&sort={sort?}&query={query?}&repo={repo?}
But I'm not sure how to pass the property name of the document in the query parameter.
For ex:
My docuemt content model is: dc:InvoiceModel
Property name is: dc:doctype.
So, I want to pass the dc:doctype as query parameter to fetch all the documents of this property type. The documents are inside a folder in the documentLibrary
I tried doing this:
http://localhost:8080/alfresco/s/slingshot/search?container=documentLibrary/newfolder&sort=dc:dc:doc...false&repo=true&startIndex=0&query={"dc:doctype":"Sales Invoice","datatype":"d:text"}
But I'm getting zero records found. Could you please help me do this.
Solved! Go to Solution.
Take a look at this example: https://documenter.getpostman.com/view/2694867/SVfRuTWU#b9df9ccc-b76a-c7e6-e50e-0e926d7ff124
You need to also encode the values for sort and query.
example:
dc:doctype|false TO dc%3Adoctype%7Cfalse
You can't use the colon in the query. Rather you should use the property name like: "prop_dc_doctype". see example here: https://documenter.getpostman.com/view/2694867/SVfRuTWU#b9df9ccc-b76a-c7e6-e50e-0e926d7ff124
datatype refers to the content/node type. e.g: cm:content not property data types like d:text.
You may have to set the tokenize property to "both"
<index enabled="true"> <atomic>true</atomic> <stored>false</stored> <tokenised>both</tokenised> </index>
Since you are using model manager, you need to set the indexing property to "Pattern - Many Matches".
You should rather deploy the model via bootstapping to better control over model.
Take a look at these docs:
http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html
https://docs.alfresco.com/content-services/5.2/develop/repo-ext-points/content-model/#definedeploy
Can you share the model where you have defined the propeties?
You can also review this doc: https://docs.alfresco.com/content-services/5.2/develop/repo-ext-points/content-model/
Sir,
This is my Alfresco version: Alfresco Community v5.1.0
This is my custom defined model!
Take a look at this example: https://documenter.getpostman.com/view/2694867/SVfRuTWU#b9df9ccc-b76a-c7e6-e50e-0e926d7ff124
You need to also encode the values for sort and query.
example:
dc:doctype|false TO dc%3Adoctype%7Cfalse
You can't use the colon in the query. Rather you should use the property name like: "prop_dc_doctype". see example here: https://documenter.getpostman.com/view/2694867/SVfRuTWU#b9df9ccc-b76a-c7e6-e50e-0e926d7ff124
datatype refers to the content/node type. e.g: cm:content not property data types like d:text.
You may have to set the tokenize property to "both"
<index enabled="true"> <atomic>true</atomic> <stored>false</stored> <tokenised>both</tokenised> </index>
Since you are using model manager, you need to set the indexing property to "Pattern - Many Matches".
You should rather deploy the model via bootstapping to better control over model.
Take a look at these docs:
http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html
https://docs.alfresco.com/content-services/5.2/develop/repo-ext-points/content-model/#definedeploy
Thanks sir, got it!
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.