Foros de discusión

Search documents using Tags in JSON WS

Pawan Thakur, modificado hace 8 años.

Search documents using Tags in JSON WS

Junior Member Mensajes: 37 Fecha de incorporación: 11/05/15 Mensajes recientes
Hello,

I am trying to search files from Liferay using tags.

http://localhost:8080/api/jsonws?signature=%2Fdlapp%2Fsearch-2-repositoryId-searchContext
http://localhost:8080/api/jsonws?signature=%2Fdlapp%2Fsearch-3-repositoryId-searchContext-query

After a lot of hit an trial I have reached here:
Request
Liferay.Service(
'/dlapp/search',
{
repositoryId: 20711,
searchContext: {assetTagNames: ['test','mytag']}
},


Response:

{
"collatedSpellCheckResult": null,
"docs": [],
"length": 0,
"querySuggestions": [],
"queryTerms": [
"test",
"mytag"
],
"searchTime": 0.004,
"snippets": [],
"start": 1437717531785
}


As can be seen in the image I have two documents associated with the tags but not appearing there in the result.

Can anyone assist, Please ?

Thanks,
Pawan

Archivos adjuntos:

thumbnail
Denis Signoretto, modificado hace 8 años.

RE: Search documents using Tags in JSON WS

Expert Mensajes: 375 Fecha de incorporación: 21/04/09 Mensajes recientes
Hi Pawan,

I know, like service context, when you need to instantiate searchContext object from scratch you need to initialize it with some (not fully documented) expected values. It can help taking a look to SearchContextFactory class and how searchContext is initialized.

You should solve populating searchContext inner required fields, in particular companyId and groupIds (an array with only one elmente scope Group Id).
Try adding these fields and pass tags in a single string parameter where each tag is separated by comma.

it should work!

HTH,
Denis.