• Can't findPaginated properties with select

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #30673  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
Unbenannt.png (3.24 KiB) Viewed 8945 times
Ok. Now I go to Search - Advanced and add this property and than hit "search".
Unbenannt.png
Unbenannt.png (3.24 KiB) Viewed 8945 times
But I got no results.

First think I thought of, was the DbSearchModule.java:336.
Code: Select all
String 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 all
String 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.
Attachments
Unbenannt2.PNG
Unbenannt2.PNG (4.25 KiB) Viewed 8945 times
 #30674  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.
  1. org.hibernate.search.query.hibernate.impl.FullTextSessionImpl.class
  2. 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 all
String valueTrimmed = ent.getValue().trim().toLowerCase();
...mixed case isn't working anymore. But if I use toLowerCase...mixed cases are working? Hm???????
 #30696  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.
 #30750  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".
 #30766  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-
 #30775  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?
 #30781  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 )
 #30830  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.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.