Foren

How to get search results in a api call as json

rayvanth challa, geändert vor 6 Jahren.

How to get search results in a api call as json

New Member Beiträge: 23 Beitrittsdatum: 22.01.16 Neueste Beiträge
Hello All,

in my project we have a java app which has to show liferay search results on its dashboard page. How can i achieve it?

I have gone through liferay api's @ "http://localhost:8080/api/jsonws" but not sure which api/end point to call for dms search results.

We are storing only documents in liferay. And i have to perform my search only on that dms module.

How to get searchresults as a json? How to customize search results in liferay?
I need only title, description and document url as response. How can i achieve it?

My Research below:

In Postman tool I tried to access this url "http://localhost:8080/api/jsonws/dlapp/search/" and provided input params as below

repository-id/20158/search-context/%7B%22title%22%3A%22liferayjson%22%7D

repository-id:20158
searchContext: {"title":'liferayjson'}

but it returned so many results which includes the above title as well. Here is sample/partial response
Response:
"docs": [
{
"UID": "com.liferay.document.library.kernel.model.DLFileEntry_PORTLET_30851",
"fields":
{
"uid":{}
"entryClassPK":{}
"classPK": {}
"companyId": {}
"entryClassName": {}
"description": {}
"classNameId": {}
"title": {}
"content": {}
},
"portletId": "com.liferay.document.library.kernel.model.DLFileEntry"
}

I need just the uid, description, title and content to be sent as a json response.

any thoughts on this will be greatly appreciated.

Thanks
Ray
thumbnail
Denis Signoretto, geändert vor 6 Jahren.

RE: How to get search results in a api call as json

Expert Beiträge: 375 Beitrittsdatum: 21.04.09 Neueste Beiträge
Hi rayvanth,

if you want an optimized and customized JSON response the best way I suggest is to implement a custom plugin with a search remote service that performs the search through the Liferay API search engine.

Bye,
Denis.