• [solved] OKM find api returns random results

  • 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.
 #31058  by Catscratch
 
Hi there,

I don't know if it's a bug or I'm doing something wrong. But whenever I query for documents through OKMSearch (DbSearchModule) with invalid properties I get random results instead of none.

I'm using latest community sources from sourceforge.

How to reproduce.

PropertyGroups.xml:
Code: Select all
<property-groups>
  <property-group label="test" name="test">
    <input label="Input Label 1" name="test.input" />
    <select label="Select Label 1" name="test.select" type="simple">
      <option label="Option A" value="optiona" />
      <option label="Option B" value="optionb" />
      <option label="Option C" value="optionc" />
      <option label="Option D" value="optiond" />
    </select>
    <input label="Input Label 2" name="test.inputagain" />
  </property-group>
<property-groups>
And now some documents in the system.

At least I try to find documents with invalid properties (just to check if a document is in the system containing a specific property).
Code: Select all
Map<String, String> properties = new HashMap<String, String>();
properties.put("roflmao", "awesome");

QueryParams p = new QueryParams();
p.setProperties(properties);
List<QueryResult> res = okm.find(p);
System.out.println(res.size());
Now I get 13 (!) documents. I don't know why I get this 13 documents, but I would assume to get no result, because there is no property "roflmao".

Thanks for hints.

Regards.
Last edited by Catscratch on Wed Feb 04, 2015 7:59 am, edited 1 time in total.
 #31081  by jllort
 
First of all, you're using property groups in wrong way, the keys are wrong, you should use okg:XXXX at the begining for property group name definition and okp:XXX.YYYY for each property field.

You <property-group label="test" name="test"> is not right

Take a look here http://wiki.openkm.com/index.php/Proper ... definition and follow your definitions in same way.

Then try with something like:
Code: Select all
Map<String, String> properties = new HashMap<String, String>();
properties.put("okp:roflmao", "awesome");
Also try without setting the property ( could be a internal feature what cleans bad properties name and really you're doing something like full search without any restriction ).
 #31141  by Catscratch
 
jllort wrote: Also try without setting the property ( could be a internal feature what cleans bad properties name and really you're doing something like full search without any restriction ).
You're right. Without setting any parameter in QueryParams...13 results are returned. Strange!

Do you have any idea what magic is happening there?

Thanks!
 #31164  by jllort
 
I supect, but what is sure is that is not good idea filter by incorrect property group parameters, because is creating a lucene query what filter by values what does not exists -> that's why you get empty results.

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.