cancel
Showing results for 
Search instead for 
Did you mean: 

Document Query in Unity API

Milind_Panwalka
Champ on-the-rise
Champ on-the-rise

How does the 'Literal' KeyWordOperator work in Unity API? Is it possible to search for a portion of a keyword value? e.g. If I have a document with a keyword type Account Owner that has value of "Smith John" then is it possible to retrieve all documents that have account owners that contain the string "Smith"?

3 REPLIES 3

Brian_Koning
Star Contributor
Star Contributor

Hello Milind,

I apologize for the delay in our response to your question. It is quite a good question and could prove very useful to others who are looking for this functionality.

The Hyland.Unity.KeywordOperator.Literal enumeration essentially compares the actual string value you specify for equality. Take the following code for example:

/* 1 */ query.AddKeyword("Account Owner", "*Smith", KeywordOperator.Equal, KeywordRelation.And);/* 2 */ query.AddKeyword("Account Owner", "*Smith", KeywordOperator.Literal, KeywordRelation.And);

Line 1 will add a keyword restriction for all documents with a "Account Owner" keyword value that ends with the string "Smith" (ie. John Smith, Smith, aSmith)

Line 2 will add a keyword restriction for all documents with an exact "Account Owner" keyword value of "*Smith". There is no wildcard expansion.

If you want to find all documents with an "Account Owner" keyword value containing "Smith", you would use the following restriction:

query.AddKeyword("Account Owner", "*Smith*", KeywordOperator.Equal, KeywordRelation.And);

That would be useful information in the SDK documentation. 

The above is really good info.

Can you provide an example of how to look for a blank value in the keyword and retrieve matching documents?

I tried both the following, but is of no use

query.AddKeyword("Account Owner", "", KeywordOperator.Equal, KeywordRelation.And)

and
query.AddKeyword("Account Owner", "XYZ", KeywordOperator.NotEqual, KeywordRelation.And)

For a blank value, OnBase doesn't create a keyword table record and that's why probably the Add Keyword option doesn't work.  But, that's just my guess.  Is there any other method to retrieve the data I'm looking for?