03-02-2022 11:29 PM
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.
03-07-2022 05:33 PM
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
03-04-2022 06:07 PM
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/
03-07-2022 01:14 AM
Sir,
This is my Alfresco version: Alfresco Community v5.1.0
This is my custom defined model!
03-07-2022 05:33 PM
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
03-08-2022 02:16 AM
Thanks sir, got it!
Explore our Alfresco products with the links below. Use labels to filter content by product module.