06-23-2015 02:23 PM
Hello All,
I am trying to come up with some logic to do a simple search search for Onbase documents with certain criteria using the Unity API.
Lets say I want to return documents that match the criteria, KewyordType1 = "A" and and KeywordType2 != "B". How would I do that?
I tried the following and it doesn't work as expected, the results show same documents twice for some reason.
documentQuery.AddKeyword(KeywordType1(A), KeywordOperator.Equal, KeywordRelation.And); //Criterion 1
documentQuery.AddKeyword(KeywordType2(B), KeywordOperator.NotEqual, KeywordRelation.And);//Criterion 2
Does the keywordTypes have to be the same when using Keyword Relations?
Another thing I tried to do is to use QueryKeywordRecordType
QueryKeywordRecord qryKw = onbaseApp.getCore().getKeywordRecordTypes().Find("Standard Keyword Types").CreateQueryKeywordRecord();
queryKw.AddKeyword(KeywordType1(A), KeywordOperator.NotEqual);
queryKw.AddKeyword(KeywordType2(B).CreateKeyword(7807696), KeywordOperator.Equal);
But since I don't have the KeywordType1 and KeywordType2 mapped to "Standard Keyword Types" I get an error. In fact KeywordType1 and KeywordType2 are not mapped to any keywordRecordTypes.
Any help on this appreciated.
Thanks,
Harish
06-26-2015 11:47 AM
Rephrased question:
I reached out to the API support on this and the answer there is not a way currently in the Unity API where we can filter results according the example I had above. We just have to check keywords on each document from the results.
I am posting the answer from API support here in case if it helps anyone else.
06-23-2015 03:45 PM
Hi Harish,
What you're trying should work.
I tested your exact example, and it works properly for me. Have you also added document type(s) or a custom query to the DocumentQuery?
Here is a snippet of code I used to test this:
DocumentQuery dq = app.Core.CreateDocumentQuery();dq.AddDocumentType(app.Core.DocumentTypes.Find(101));dq.AddKeyword(app.Core.KeywordTypes.Find(1).CreateKeyword("TEST SET"), KeywordOperator.Equal, KeywordRelation.And);dq.AddKeyword(app.Core.KeywordTypes.Find(102).CreateKeyword("TEST SET"), KeywordOperator.NotEqual, KeywordRelation.And);DocumentList dl = dq.Execute(100);app.Diagnostics.Write(dl.Count.ToString());
This accurately found the documents I was searching for and wrote the count of retrieved documents to the Diagnostics Console.
06-24-2015 10:10 AM
06-26-2015 11:47 AM
Rephrased question:
I reached out to the API support on this and the answer there is not a way currently in the Unity API where we can filter results according the example I had above. We just have to check keywords on each document from the results.
I am posting the answer from API support here in case if it helps anyone else.
06-29-2015 05:49 AM
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.