Page 1 of 1

Issue with finding documents with entered metadata.

PostPosted:Mon Mar 16, 2015 8:29 am
by tsagar
Hi,

We have a requirement wherein we need to find all documents with the specific meta-data, we have generated the client stubs using apache cxf
There are 3 documents which is having unique meta-data.
But we have set specific meta-data in the client stubs(which has only 1 document associated with that meta-data),
in response we are getting all the 3 document results.
Expected result is only 1 document

Actual result obtained is 3 document.

Can you please help us in resolving the above issue.

Refer the below code which we have used.
Code: Select all
{
        System.out.println("Invoking find...");
        java.lang.String _find_token = "322754b3-1c84-463d-9bb3-e3c46d9e18bb";
        gov.state.nextgen.okm.search.QueryParams _find_params = new gov.state.nextgen.okm.search.QueryParams();
        
        QueryParams.Properties qpm =  new QueryParams.Properties();
        QueryParams.Properties.Entry entry = new QueryParams.Properties.Entry();
     	entry.setKey("Name");
        entry.setValue("Tushar");
        qpm.getEntry().add(entry);
	    _find_params.setPath("/okm:root/");    
        _find_params.setProperties(qpm);
        _find_params.setDomain(1);
        try {
            java.util.List<gov.state.nextgen.okm.search.QueryResult> _find__return = port.find(_find_token, _find_params);
            for (QueryResult queryResult : _find__return) {
            	 System.out.println("find.queryResult=" + queryResult.getDocument().getPath());
			}
            System.out.println("find.result=" + _find__return);

        } catch (ParseException_Exception e) { 
            System.out.println("Expected exception: ParseException has occurred.");
            System.out.println(e.toString());
        } catch (DatabaseException_Exception e) { 
            System.out.println("Expected exception: DatabaseException has occurred.");
            System.out.println(e.toString());
        } catch (RepositoryException_Exception e) { 
            System.out.println("Expected exception: RepositoryException has occurred.");
            System.out.println(e.toString());
        } catch (IOException_Exception e) { 
            System.out.println("Expected exception: IOException has occurred.");
            System.out.println(e.toString());
        }
            }
            

Re: Issue with finding documents with entered metadata.

PostPosted:Wed Mar 18, 2015 6:35 pm
by jllort
Seems you're doing query by WS ( SOAP ).
Which is your openkm version ?
My suggestion is you take advantage of our SDK libraries ( in your case sdk4j http://wiki.openkm.com/index.php/SDK_for_Java_1.1 )

First of all, these lines are wrong sure, specially the key, name is not a valid property group field name, should be something like "okp:XXX.name":
Code: Select all
entry.setKey("Name");
entry.setValue("Tushar");
If a property group field is not found, really is rejected from the query ( is not shown and error, this feature for you now is a problem :) ).

Share here your property group definition to take a look about how have you done it.

Re: Issue with finding documents with entered metadata.

PostPosted:Wed Mar 18, 2015 6:55 pm
by tsagar
Thanks for the reply.
What should be my key and value to find documents based on meta-data.
The propertygroup.xml is mentioned below
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.0//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.0.dtd">
<property-groups>  
  <property-group label="DM" name="okg:dm">
    <input label="CaseNum" type="text" name="okp:dm.caseNum"/>
	<input label="ID" type="text" name="okp:dm.id"/>
    <input label="IndividualId" type="text" name="okp:dm.indvId" />
	<input label="DateReceivedEnd" type="date" name="okp:dm.endDate" />
	<input label="BeginDate" type="date" name="okp:dm.beginDate" />
	<input label="DocumentType" type="text" name="okp:dm.documentType"/>
	<input label="Program" type="text" name="okp:dm.program"/>
	<input label="DocTypeSW" type="text" name="okp:dm.docTypeSW"/>
	<input label="Size" type="text" name="okp:dm.size"/>
	<input label="IsDeleted" type="text" name="okp:dm.isDeleted"/>
  </property-group>
  
</property-groups>

Re: Issue with finding documents with entered metadata.

PostPosted:Sat Mar 21, 2015 11:58 am
by tsagar
I got the solution, I was setting the key value incorrectly.
The correct way is mentioned below.
Code: Select all
entry.setKey("okp:consulting.name");
entry.setValue("Tushar");
Thanks Jillort. :)