cancel
Showing results for 
Search instead for 
Did you mean: 

How to search document based on custom model properties using Rest API

MOH_MCT
Champ in-the-making
Champ in-the-making

Hello,

Need your help to execute task where I need to search document based on custom model properties.

Task performed-

with Rest API POST '/nodes/{nodeId}/' - I have uploaded document.

As I already developed my content model aspect and property

with Rest API PUT '/nodes/{id}' - I have updated my document with content model property and based on this property I got my aspect name in response.

Task I need to Performed-

Based on this property I need to fetch my document.

Need your help to execute this task by using Rest API

20 REPLIES 20

EddieMay
World-Class Innovator
World-Class Innovator

Hi @MOH_MCT ,

Here are two threads about searching custom model properties. The first relates to the problems sometimes caused by locale.  The second relates to tokenised value. Both have source code that might help you start.

HTH

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

MOH_MCT
Champ in-the-making
Champ in-the-making

Hi @EddieMay 

before making Rest API call I am searching my document in alfresco share under Node Browser selecting Lucene as search.

But I am getting the following error- 05181400 Request failed 500 /solr/alfresco/alfresco?wt=json&fl=DBID%2Cscore&rows=100&df=TEXT&start=0&locale=en_US&alternativeDic=DEFAULT_DICTIONARY&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON

request for search

TYPE:"cm:content" AND od:ReObjID:"OmGanesh"

where od:ReObjID is my custom content model property  and OmGanesh is my value.

MOH_MCT
Champ in-the-making
Champ in-the-making

Hello,

Can anyone help me with this?

Use the Search API:

https://api-explorer.alfresco.com/api-explorer/#!/search/search

The JSON Body should be something similar to:

{
  "query": {
    "query": "TYPE:\"cm:content\" AND od:ReObjID:\"OmGanesh\""
  }
}
Hyland Developer Evangelist

MOH_MCT
Champ in-the-making
Champ in-the-making

@angelborroy 

After trying the same JSON I am getting the following error:

//{
  "error": {
    "errorKey": "framework.exception.ApiDefault",
    "statusCode": 500,
    "briefSummary": "05221526 Request failed 500 /solr/alfresco/afts?wt=json&fl=DBID%2Cscore&rows=100&df=TEXT&start=0&locale=en_US&alternativeDic=DEFAULT_DICTIONARY&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON",
    "stackTrace": "For security reasons the stack trace is no longer displayed, but the property is kept for previous versions",
    "descriptionURL": "https://api-explorer.alfresco.com",
    "logId": "5493511c-1c08-470f-9817-bd34f0675e71"
  }
}//
JSON Request Used
//{ "query": { "query": "TYPE:\"cm:content\" AND od:ReObjID:\"OmGanesh\"" } }//
Kindly help me with this

MOH_MCT
Champ in-the-making
Champ in-the-making

Hello,

Can anyone help me with this?

Can you attach some information from you alfresco.log?

Hyland Developer Evangelist

MOH_MCT
Champ in-the-making
Champ in-the-making

Hi @angelborroy 

I am attaching logs please download it from a link

https://drive.google.com/drive/folders/17ne9en04wQwWcvRYWTo2olOVsbWVc3GB?usp=sharing

Please let me know how i can overcome this issue

MOH_MCT
Champ in-the-making
Champ in-the-making

Hi,

Any Update plz?