Page 1 of 1

SDK Java 1.1 find() method

PostPosted:Fri Dec 22, 2017 9:30 am
by PSHREYASHOLLA
Hi,

In SDK java 1.1, We are using API com.openkm.sdk4j.OKMWebservices.find(QueryParams) to fetch list of documents based on properties.
We want all the documents to be retrieved which has that corresponding property.

Query is if the Result which is a list is sorted on the document created date?

Re: SDK Java 1.1 find() method

PostPosted:Sat Dec 23, 2017 10:48 am
by jllort
The result is not based on document creation, is based on lucene score. That means will be retrieved the documents with high score ( from lucene point of view. The score of the document is based on lucene and the query you are executing ).

About search with metadata in this documentation section https://docs.openkm.com/kcenter/view/sd ... dPaginated ( look at the first table in column variable where values is properties there's a sample on how doing it).

Re: SDK Java 1.1 find() method

PostPosted:Fri Dec 29, 2017 9:38 am
by PSHREYASHOLLA
Hi,
Our requirement is to fetch the list of documents with specified properties and
based on the order of creation.

Basically we want to have the latest records. How to achieve that?

Re: SDK Java 1.1 find() method

PostPosted:Fri Dec 29, 2017 10:04 am
by jllort
Your case seems a combination of metadata and search by date. With QueryParams bean you have everything you need for it. I suggest firt make the query from UI view ( you will see the spected results ) and then step by step try to reproduce from API. You must use properties map filtering and date range ( from and to fields into the QueryParams ).

Re: SDK Java 1.1 find() method

PostPosted:Mon Jan 01, 2018 4:03 am
by PSHREYASHOLLA
As I mentioned we are using SDK java 1.1, and this are API calls and there is no UI involved. There will be no date range as well, as We want to fetch all the documents(With specified Properties) uploaded to OpenKM in the order of Creation.

Re: SDK Java 1.1 find() method

PostPosted:Mon Jan 01, 2018 6:37 am
by PSHREYASHOLLA
As I mentioned we are using SDK java 1.1, and this are API calls and there is no UI involved. There will be no date range as well, as We want to fetch all the documents(With specified Properties) uploaded to OpenKM in the order of Creation. So how can we achieve this
?

Re: SDK Java 1.1 find() method

PostPosted:Mon Jan 01, 2018 5:34 pm
by jllort
As I said, search engine never will return data based on date, it returns based on score. I do not understanding exactly what is the problem you are trying to solve, but for example, you can make a query ( search engine ) to return only document into a single day and then order the list ( simple collections sort ). Also you will be able to retrieve data from direct SQL on tables, but in this case you are outside security manager etc.. if you explain with more detail the type of problem you are trying to solve might be we can give you more clues what going in that way ( if you ask for the solution you have in mind might be we are losing the focus ).

Re: SDK Java 1.1 find() method

PostPosted:Tue Jan 02, 2018 4:43 am
by PSHREYASHOLLA
In our OpenKM we have created a new property,
Code: Select all
 <property-group label="BMS" name="okg:BMS">
               <input label="PARTY_ID" type="text" name="okp:OPENKM.BMS_PARTY_ID" readonly="true"/>
 </property-group>

We are using SDK java 1.1 and there is no OpenKM UI involved here.

First we are uploading documents using,

OKMWebservices.createDocumentSimple(String docPath, InputStream is);

And then associate the above mentioned property for the each document uploaded using,

OKMWebservices.setPropertyGroupPropertiesSimple(String nodeId, "okg:BMS", Map<String, String> properties)


The documents get uploaded over the period of time and not on a single day.

Suppose over the period of time I have uploaded 10 documents and all 10 documents are set with the same property name/value.

Now the requiremant is to retrieve only the latest 4 documents uploaded(DateTime of uploading) associated with that property.


Example, here we are uploading users Signatures over a period of time with different document names and all these documents will have the same property value associated with it. AT any point of time we need to retrieve the latest 4 signatures(Based on DateTime) of that particular user(Based on the Property).




How can we achieve this?

Please let me know if you want more inputs

Re: SDK Java 1.1 find() method

PostPosted:Wed Jan 03, 2018 4:10 pm
by jllort
From search engine is not possible get list ordered, from this point we can discard it ( if you have some date range might be possible, but if you want from the end of times is not possible ).

An aproach might be:
1- Add a metadata field with date.
2- Create a view in the database or execute a query, using this metadata field to retrieve the involved documents.
3- Execute a query from API ( in the repositoryService you have a method named executeSqlQuery https://github.com/openkm/document-mana ... .java#L305 -> unfortunately we have still not exposed across SDK ). You can an issue to add this improvement in the SDK, really during this year we will extend the REST API in the JAVA SDK.