• Metadata properties ignored when using find method of SDK

  • 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.
 #48381  by zaans2
 
When using the find method of the .NET SDK 1.2.2 (And 1.2.3 Alpha I got provided in another thread) it looks like the metadata properties I select are ignored.
Code: Select all
	Dim properties = New Dictionary(Of String, String)
	properties.Add("okp:foo", "bar")
	
	Dim searchTerm = "bar"
        Dim queryParams = New QueryParams With {
                .properties = properties,
                .domain = bean.QueryParams.DOCUMENT,
                .name = searchTerm
                }

        Try
            result = ws.find(queryParams)
        Catch exc As System.Exception
		Console.writeLine(exc.ToString())
        End Try
If I use the above code I get all results with "bar" in the name, even if a document doesn't have "bar" as the value of the property "okp:foo". I expect to only get the documents with "bar" in the name AND "bar" as value of the property "okp:foo"

Looking at the API description (https://docs.openkm.com/kcenter/view/ok ... pertyValue) I am doing it right but it doesn't work as expected. Am I doing something wrong or is what I am expecting to happen not correct?
 #48401  by zaans2
 
I don't know where it exactly should happen but I have found out what is happening.

The dictionary that is set as a QueryParam gets converted into a `List<string>` in the class `BeanHelper` in the method `dictionaryToList` (line 187-196). When the URI is built this list is never converted to a URL encoded string. The instance itself gets URL encoded and put into the string.
 #48458  by pherrera
 
Hi,
Thanks for the observation, I was not filtering through the properties.
Try this new compilation of sdk:
(69.08 KiB) Downloaded 149 times
[/b]
According to your metadata example, your query should look like this:
Code: Select all
            Dim properties = New Dictionary(Of String, String)
            properties.Add("okp:foobar.foo", "foo.intern")

            Dim searchName = "AnyFileName*"
            Dim queryParams = New QueryParams With {
                .domain = bean.QueryParams.DOCUMENT,
                .name = searchName,
                .properties = properties
                }

            Dim result = New List(Of QueryResult)
            result = ws.find(queryParams)
where the "name = searchName" will use it if you want to search also by the name of the file or just remove it.
This is not correct: properties.Add ("okp:foobar.foo", "bar")
according to your metadata definition the name is "okp:foobar.foo" and the value is "foo.intern" then -> properties.Add("okp:foobar.foo", "foo.intern")
Code: Select all
<select label="Foo" name="okp:foobar.foo" type="simple" >
            <option label="FooInternal" value="foo.intern"/>
            <option label="FooExternal" value="foo.extern"/>
        </select>
Please try it, I await your answer.
Regards.

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.