cancel
Showing results for 
Search instead for 
Did you mean: 

Text Search throwing Exception

David_Taylor
Star Contributor
Star Contributor

I am attempting to locate documents using the built-in text searching capabilities (TextDataProvider.TextSearch) but am receiving the following exception:

"An error occurred within the Unity API: Required input parameter 'DocumentID' is missing for: TextSearch (Method: 'textSearch', Type: 'Hyland.Core.Unity.Services.DataProviderService, Hyland.Core.Unity, Version=17.0.1.75, Culture=neutral, PublicKeyToken=null'"

The code for retrieval is below:

var searchResult = _application.Core.Retrieval.Text.TextSearch(document.DefaultRenditionOfLatestRevision, "ERROR", TextSearchOptions.CaseSensitive);

The method signature doesn't give me anywhere to input a document ID, how do I avoid this exception?

1 ACCEPTED ANSWER

Adam_Kuhn
Star Collaborator
Star Collaborator

Hi David --

I have a couple questions that may help us troubleshoot:

  • In what context is the script being executed? (i.e. is this an external app or a Unity script, and if the latter, which interface?)
  • Which rendition are you executing the search against?
  • Are you attempting to run a search against an UnindexedDocument?

Best, AK

View answer in original post

4 REPLIES 4

Adam_Kuhn
Star Collaborator
Star Collaborator

Hi David --

I have a couple questions that may help us troubleshoot:

  • In what context is the script being executed? (i.e. is this an external app or a Unity script, and if the latter, which interface?)
  • Which rendition are you executing the search against?
  • Are you attempting to run a search against an UnindexedDocument?

Best, AK

David_Taylor
Star Contributor
Star Contributor
  • This is an external WinForms application.
  • The rendition is document.DefaultRenditionOfLatestRevision. In my particular case it is "text" rendition of revision 0
  • I don't know whether this document is un-indexed or not (don't know where to look) but I do know the text-search feature works fine within the OnBase thick client.

Reading the content of the same text file works just fine using the code below:

using (var pageData = _application.Core    .Retrieval.Text    .GetDocument(document.DefaultRenditionOfLatestRevision)){    using (var reader = new StreamReader(pageData.Stream))    {        textBox1.Text = reader.ReadToEnd();    }}

I may have misspoken, I apologize -- what I meant was, what is the origin of the document you're getting the DefaultRenditionofLatestRevision of? What is its default file format and document type? Can you pull back a positive non-zero int for document.ID?

David_Taylor
Star Contributor
Star Contributor

Sorry for the delayed response... This is a verification report for a DIP import. I believe that means it's native format is text.

I'm trying to loop through verification reports for a particular DIP process and find any with errors in them. From that point I would be able to parse out information such as batch #, etc.

== edit ==

To clarify, the end goal is to do what I said above, in this instance I was just testing the text search portion of this against a verification report. Looping had not been implemented yet.