Page 1 of 1

Find webservice not working with SDK4J

PostPosted:Fri Sep 19, 2014 1:26 pm
by Raphel
Hi ,
I am using SDK4J version 1.0 and trying to perform full text search with 'Find' webservice to return documents containing the search text. Following is the code snippet I have used.
Code: Select all
	public List<QueryResult> searchDocs(String searchText) throws Exception{
	    OKMWebservices okmWebservices = OKMWebservicesFactory.newInstance(OKM_ENDPOINT_URL, FileHandlingPropertiesUtil.getProperty("USERNAME"),
					FileHandlingPropertiesUtil.getProperty("PASSWORD"));			
		List<QueryResult> resultList = null;
		QueryParams queryParams = new QueryParams();
	try{
		String docPath = "/okm:root/Integ/Award_Integ/";

		queryParams.setPath(docPath);
		queryParams.setContent(searchText);
		queryParams.setDomain(1);

		resultList = okmWebservices.find(queryParams);
	} catch (Exception e) {
		log.error("Exception : "+ CommonUtil.writeErrorLog(e));
	} 
	return resultList;
	}
The search text used returns valid result if I perform the same search using OpenKM repository GUI. But when I perform the same search through our application, using the above code, it is returning empty result. This used to work with Open KM 6.2 without SDK4J. But after replacing with SDK4J, the full text search using 'Find' webservice is not working.
Please let me know if I am missing anything here.

I have tried with 'FindByContent' and that is also failing.

Re: Find webservice not working with SDK4J

PostPosted:Sun Sep 21, 2014 6:41 am
by jllort
1- does the user have enought grants to see the results ?
2- From UI you're using findPaginatedMethod

Is not a SDK problem, seems filtering by path does not like in this OpenKM version. If you remove queryParams.setPath(docPath); will go right ( also you can test in UI and you will observate the same, when you set the path, query does not going right ).

Your code will be more correct with:
Code: Select all
qp.setDomain(QueryParams.DOCUMENT);

Re: Find webservice not working with SDK4J

PostPosted:Tue Sep 23, 2014 8:08 am
by connect2selva
I face the same issue, Im able to see the results in List<QueryResult> in find method, But Node object inside QueryResult is coming as null, But 'getExcerpt' returns the values which matched with OpenKM UI. What could be the issue How can I resolve it. My snippet below

I tried with both findPaginated and find. Both are returning results with null Node. I have tried the same user as UI, So he has the privilege for the file
Code: Select all
       QueryParams queryParams = new QueryParams();
		queryParams.setContent("cnumb4");
		queryParams.setDomain(QueryParams.DOCUMENT);

List<QueryResult> resultList = okmWebservices.find(queryParams);
for (QueryResult qr : resultList)
		{
//			Node doc = qr.getNode(); //Node is coming as Null
//			System.out.println(doc.getUuid());
			System.out.println(qr.getExcerpt());
		}
It works when I tried for http://demo.openkm.com/OpenKM, But it doesn't work for our OpenKM server. Do we need to do anything on the server to get the node properly.

Re: Find webservice not working with SDK4J

PostPosted:Thu Sep 25, 2014 9:01 am
by jllort
I think you're using sdk 2.0 what goes right with openkm 6.4 but for openkm community 6.3 you should use sdk 1.0 , take a look at the description table http://wiki.openkm.com/index.php/SDK_for_Java