Page 1 of 1
Can't findPaginated properties with select
PostPosted:Wed Dec 10, 2014 9:32 am
by Catscratch
Hi,
I got a problem.
Assume the following property group:
Code: Select all<property-group label="test" name="pc.Test">
<select label="MySelect" name="pc.test.Select" type="simple">
<option label="Option1" value="pc.test.Select.Id1" />
<option label="Option2" value="pc.test.Select.Id2" />
</select>
</property-group>
I added this property to a document.
Unbenannt.png (3.24 KiB) Viewed 8949 times
Ok. Now I go to Search - Advanced and add this property and than hit "search".
Unbenannt.png (3.24 KiB) Viewed 8949 times
But I got no results.
First think I thought of, was the DbSearchModule.java:336.
Code: Select allString valueTrimmed = ent.getValue().trim().toLowerCase();
There you convert the property group value to lowercase. But I really need mixed case! So I replaced this line with:
Code: Select allString valueTrimmed = ent.getValue().trim(); // Bugfix for case sensitive properties
But I still getting no results, but now the queryString looks good.
Code: Select all(+_hibernate_class:com.openkm.dao.bean.NodeDocument +context:okm_root +pc.test.Select:pc.test.Select.Id1)
Do you have any idea, whats going wrong here? I'm using the latest sources of the community edition shared on sourceforge.
Thanks a lot.
Re: Can't findPaginated properties with select
PostPosted:Wed Dec 10, 2014 9:46 am
by Catscratch
I found another hint.
It seems to be a problem with camelCase. If I only use lower case characters, everything is working.
While in OpenKM code everything is fine. But in SearchDAO.java:233 you're going into hibernate code.
- org.hibernate.search.query.hibernate.impl.FullTextSessionImpl.class
- org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.class
There something happens (I got no source code to debug here), and than the SearchDAO receives the query result.
So it seems, hibernate got some problems with camelCase.
Do you have an idea what this problem could be?
Thanks.
Edit: I found another interessting hint. If I remove toLowerCase() from
Code: Select allString valueTrimmed = ent.getValue().trim().toLowerCase();
...mixed case isn't working anymore. But if I use toLowerCase...mixed cases are working? Hm???????
Re: Can't findPaginated properties with select
PostPosted:Fri Dec 12, 2014 9:19 am
by jllort
I suggest do not use strange characters for your value "pc.test.Select.Id1" do as "pcTextSlectId1" ( better without white spaces, points, - etc... ) os use number like 001, 002 etcc ( normalized in length ), that will also be a good practice.
Re: Can't findPaginated properties with select
PostPosted:Thu Dec 18, 2014 8:10 am
by Catscratch
Ok, I found a reproducable case.
Code: Select all<property-group label="test" name="testid">
<select label="MySelect" name="selectid" type="simple">
<option label="Option1" value="Optiona" />
<option label="Option2" value="optionb" />
</select>
</property-group>
There, I can search for Option B but not for Option A. The only difference is the first uppercase character of
Optiona. When I change property group to "
optiona" instead of "
Optiona", everything is working.
But when I remove the toLowerCase() of valueTrimmed, nothing is found anymore.
I don't know whats happening in hibernate behind. But do you have any idea how I may be able to use mixed case option values in selects? I really need something like "optionA" is different than "optiona".

The databases behind (tested with Postgres, MySQL and internal) differentiates between lower and upper case characters. So inside the database, I can use "optionA" and "optiona".
Re: Can't findPaginated properties with select
PostPosted:Sat Dec 20, 2014 12:17 pm
by jllort
Why are you using databaes query and not openkm search engine ( lucene available from openkm API ? ). My suggestion is take value as primary key value you'll use in database ( do not use strange characters etc... ) good practice are lowercase text or better convert to 001, 002 -> 999 values ( that sure will go right too ), if you're doing some application in source code you can map 001 value to a string contant-
Re: Can't findPaginated properties with select
PostPosted:Sat Dec 20, 2014 7:36 pm
by Catscratch
I'm still using the okm search engine (findPaginated) with a specific property group map to find. THAT is the problem, because the resulting query generated by openkm only contains lowercase property groud property ids. So, if I have a property id with an upper case, I'm not able to find it through openkm search engine. But for me it is really important if a property id is "id" or "ID", because on a later state I need this knowledge to map this id into another datebase for additional metadata etc.
So I'm only wondering, why you do "String valueTrimmed = ent.getValue().trim().toLowerCase();" - for some reason?
Re: Can't findPaginated properties with select
PostPosted:Sun Dec 21, 2014 12:35 pm
by jllort
For what I understood internally we're are optimizing query values to lower case. Well that can be done for several reason, the first is that has not much sense do primary keys in lower and upper case. For example imagine you're tagging files with keywords, and somebody wrote "House" and other wrote "house" these terms are exactly the same. We've founded in the past some problems on users what are using uppercase and lowercase in this scenarios and that could be the reason why we've decided apply some optimization internally to force all in lowercase ( for what you told us, this is causing a problem to you ).
In my opinion, the problem is not upper case or lower case, the problem from my point of view is that you're doing bad use of primary keys. My suggestions what covers openkm optimization and your needs is mapping your wished primary keywords values, for example:
your_value okm_internal_value
optiona 001
Optionb 002
And simply you need a method to translate your values to openkm and vicevera. ( From openkm UI only are show descriptions, then your problem must be in some kind of remote integration )
Re: Can't findPaginated properties with select
PostPosted:Mon Jan 05, 2015 10:12 am
by Catscratch
Ok, thanks for the information. I will think about some kind of mapping mechanismen. It's a bit sad, because I hoped to find a solution for using mixed case primary keys. The database system below (MySQL, PostgreSQL, ...) all allow mixed keys (like 'Keya' is not the same as 'keya'). But it seems hibernate absorbs mixed primary keys in some way.