Foren

Search using JSON WS

Pawan Thakur, geändert vor 8 Jahren.

Search using JSON WS

Junior Member Beiträge: 37 Beitrittsdatum: 11.05.15 Neueste Beiträge
Hi,

I am trying to perform the Search using provided JSON Services, I would really appreciate some help here. I read Java docs for the same methods and they say that query its just simple name-value pair string but no success for me there. Also I am not sure how to pass Keywords as well.

In Code I saw how it works,
searchContext.setKeywords(keywords);
searchContext.setAttribute("paginationType", "more");
searchContext.setStart(0);
searchContext.setEnd(10);


And my following WS requests is yielding results but the document cannot be found though I have a document with same name

Liferay.Service(
'/dlapp/search',
{
repositoryId: 20711,
searchContext: {"keywords":"k7.png", "start":0,"end":10 }
},
function(obj) {
console.log(obj);
}
);


{
"collatedSpellCheckResult": "k7 png",
"docs": [],
"length": 0,
"querySuggestions": [],
"queryTerms": [
"k7.png"
],
"scores": [],
"searchTime": 0.006,
"snippets": [],
"start": 1436160893616
}


I want to use this webservice


Liferay.Service(
'/dlapp/search',
{
repositoryId: 20711,
searchContext: {"start":0,"end":10},
query: WHAT TO SEND? FORMAT TO SEND?
},
function(obj) {
console.log(obj);
}
);


Can anyone tell me what format the QUERY Parameter expects like a JSON string a NV pair.
A sample query or any online reference links would be really helpful.

Thanks in advance.
Pawan
Pawan Thakur, geändert vor 8 Jahren.

RE: Search using JSON WS

Junior Member Beiträge: 37 Beitrittsdatum: 11.05.15 Neueste Beiträge
Hello,

Adding more content and hoping to receive an answer.

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