Page 1 of 1

Searching using Openkm 6.3.1, sdk4csharp 1.1.1

PostPosted:Fri Aug 19, 2016 10:03 am
by ofstab
I am having a problem using the search facilities in Openkm with version 1.1.1 of the sdk for c#.

First, here is my test code, adapted from the examples: https://docs.openkm.com/kcenter/view/sd ... yPaginated.
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;

namespace openkm_search_test
{
    public class Program
    {
        static void Main(string[] args)
        {
            String host = "http://[my server ip]:8080/OpenKM";
            String username = "okmAdmin";
            String password = "admin";
            OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password);

            try
            {
                QueryParams qParams = new QueryParams();
                qParams.domain = QueryParams.DOCUMENT;
                qParams.name = "ipad";
                qParams.folder = "[uuid of folder I wish to search]";
                ResultSet rs = ws.findPaginated(qParams, 0, 10);
                System.Console.WriteLine("Total results:" + rs.total);

                foreach (QueryResult qr in rs.results)
                {
                    System.Console.WriteLine(qr);
                }
            Console.WriteLine("Press Enter to terminate...");
            Console.Read();
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.ToString());
            }
        }
    }
}
So what is the problem?

In the folder I wish to search, there are 4 documents with the text "ipad" in their names. If I use the browser UI, check "use advanced mode", put "ipad" in the name box, and the full folder path in the Advanced->Folder box and click search then I get 4 results. All as expected.

However if I run the above code, I get this:
Code: Select all
Total results:28
com.openkm.sdk4csharp.bean.QueryResult
Press Enter to terminate...
It is searching the whole repository, not just the folder uuid I fed it, and finding 28 results. The weird thing is that the rs.count = 1, but rs.results=28. I was expecting rs.count to be 10.

Also, the one result that is found has no data associated with it.

Any clue what is going on? Is search broken in sdk 1.1.1?

Re: Searching using Openkm 6.3.1, sdk4csharp 1.1.1

PostPosted:Sat Aug 20, 2016 2:56 pm
by jllort
Here some suggestion:
Code: Select all
Params.name = "ipad*"; // put here the * ( wildcard )
qParams.path = "use  the path"; // should not be qParams.folder should be qParams.path ( confirm this point because here could be some bug )./code]

Re: Searching using Openkm 6.3.1, sdk4csharp 1.1.1

PostPosted:Mon Aug 22, 2016 8:34 am
by ofstab
Thanks.

With qParams= "ipad*" (with wildcard) I get 0 results.

I cannot compile with qParams.path because "QueryParams does not contain a definition for path"

Re: Searching using Openkm 6.3.1, sdk4csharp 1.1.1

PostPosted:Tue Aug 23, 2016 2:57 pm
by jllort
I think this is a bug, we will review it

Re: Searching using Openkm 6.3.1, sdk4csharp 1.1.1

PostPosted:Thu Aug 25, 2016 2:29 pm
by ofstab
I am happy to take a glance at the code if that would help. Don't think this is online?
I have another problem with an empty stream being returned from getcontent which may also have an answer in the code.

Thanks.

Re: Searching using Openkm 6.3.1, sdk4csharp 1.1.1

PostPosted:Sat Aug 27, 2016 9:21 am
by jllort
OpenKM SDK's comes with non GNU licencese, you can take a look here https://docs.openkm.com/kcenter/view/li ... ement.html ( actually the code is not shared ).

About the other problem, with getContent, please add another post.

Re: Searching using Openkm 6.3.1, sdk4csharp 1.1.1

PostPosted:Thu Aug 24, 2017 2:55 pm
by pherrera
The problem is solved, you can try the new version: https://docs.openkm.com/kcenter/view/sdk4net-1.1.2/