Page 1 of 2
Any way to get document type values?
PostPosted:Mon Oct 15, 2012 9:18 am
by shaardu
I dont want people to delete the property group from xml, so is there any way to check if that propertygroup has some value associated with it. I mean, if there are some documents that has that property group associated with it.
Re: Any way to get document type values?
PostPosted:Wed Oct 17, 2012 1:53 pm
by jllort
The easiest way to know it is connect as okmAdmin and search by this property ( for each context ). If there's no results then no document has it associated.
Re: Any way to get document type values?
PostPosted:Thu Oct 18, 2012 5:17 am
by shaardu
Thanks for the suggestion but I tried looking through the entire apis, also through search modules, but there isnt any api to use property group search result. Also there is no single way where we can get the property group results.
Re: Any way to get document type values?
PostPosted:Fri Oct 19, 2012 7:50 pm
by jllort
You should use OKMSearch -> serarch webservices and use method find. There's only one parameter querParam into you have a map<String,String> called properties. The idea is you define here the metadata values as String, String -> metadata key, value
Take as example in java code:
Code: Select allMap<String, String> properties = new HashMap<String, String>();
properties.put("okp:expiration.date", ISO8601.formatBasic(from) + "," + ISO8601.formatBasic(to));
properties.put("okp:expiration.state", "valid");
QueryParams params = new QueryParams();
params.setPath("/okm:root");
params.setProperties(properties);
List<QueryResult> results = OKMSearch.getInstance().find(null, params);
You can do similar with webservices api ( all internal api is exposed to webservices ), althought here are some examples,
http://wiki.openkm.com/index.php/Java_client_6.0 there's not exactly one with what you want, but I think can help to start.
Re: Any way to get document type values?
PostPosted:Mon Oct 22, 2012 9:40 am
by shaardu
But is there any way in Openkm to make some fields mandatory while filling propertygroups forms?
Re: Any way to get document type values?
PostPosted:Tue Oct 23, 2012 4:51 pm
by jllort
Re: Any way to get document type values?
PostPosted:Thu Oct 25, 2012 5:06 am
by shaardu
Awesome!!! Thanks a ton...Have a great day!
Re: Any way to get document type values?
PostPosted:Sat Nov 17, 2012 6:34 am
by shaardu
Hey I recently upgraded to 6.1 but unfortunately the above method of checking whether any property groups has value in it doesnt work anymore..
ie,
Code: Select allMap<String, String> properties = new HashMap<String, String>();
properties.put("okp:expiration.date", ISO8601.formatBasic(from) + "," + ISO8601.formatBasic(to));
properties.put("okp:expiration.state", "valid");
QueryParams params = new QueryParams();
params.setPath("/okm:root");
params.setProperties(properties);
List<QueryResult> results = OKMSearch.getInstance().find(null, params);
This above code works but not for "***", to get any value present!
Like, I had tried this to get any value present.
Code: Select allproperties.put("okp:expiration.state", "***");
but now this code doesnt work, i need to replace *** with some value, is there any way to use *** as in 5?
Is there any way to check whether property groups has any value in it?
Re: Any way to get document type values?
PostPosted:Sun Nov 18, 2012 8:26 am
by jllort
This code should run are you writing valid correctly. Try with some simply query and then advance with more comple I suggest remove from and too and try only with valid and before it try to make some query with name etc...
Re: Any way to get document type values?
PostPosted:Fri Nov 30, 2012 7:56 am
by shaardu
Hey actually, I am not able to search through "***" in property group search, but it works in openkm demo site!! Can you guys tel me the query used there?
here in tomcat, we are using findbyquery();
Re: Any way to get document type values?
PostPosted:Sat Dec 01, 2012 5:11 pm
by jllort
is not good idea use wildcard * in some cases you can get some lucene error, we're investigating how to solve it, but actually sometime you'll get maxClause lucene error. I do not know if it's your problem ?
Re: Any way to get document type values?
PostPosted:Sat Dec 01, 2012 5:18 pm
by shaardu
Yeah sometime, i get that error too!! but the wildcard search works fine for name ,content etc but doesnt work for property groups search!
Re: Any way to get document type values?
PostPosted:Sun Dec 02, 2012 8:29 am
by jllort
OK, Can you try in our online demo, and if error exists explain here exactly what you have done ( then we can reproduce and solve ).
Re: Any way to get document type values?
PostPosted:Mon Dec 03, 2012 9:19 am
by shaardu
Yeah I tried on demo and its working perfectly!! i cant figure out why its not working on community...
Re: Any way to get document type values?
PostPosted:Wed Dec 05, 2012 10:08 pm
by jllort
is strange because in this aspect community and professional should have very similar code.
Make a screenshot of search and capture the log error at catalina.log ( only the error ) and then post here. Because you get an error on log or simply you do not get none results.