You are viewing limited content. For full access, please sign in.

Question

Question

how to return a sdk search result list to include the annotation count per document without iterating for each document?

asked on March 17, 2014

Is it possible to return a searchResultListing to include a count of annotations within a document via the sdk without iterating for each document?

 

Our SDK code performs a search for all documents which contain a specific value in the metadata template. 

We would like to also retrieve a count of annotations against the document in the same search.

 

Does anyone if this could be achieved from the SDK by defining a SystemColumn column in the columnSpecifierCollection ?

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on March 18, 2014 Show version history

In my tests it takes less than 2 seconds to run the iteration that you are talking about using this code:

SearchResultListing result = search.GetResultListing(settings);
IList<int> counts = new List<int>(result.RowCount);
foreach (EntryListingRow row in result)
{
    int id = int.Parse(row.GetDatumAsString(SystemColumn.Id),
        NumberStyles.AllowThousands);
    DocumentInfo info = new DocumentInfo(id, session);
    counts.Add(info.GetAnnotations().Count);
    info.Dispose();
}

I ran the benchmark using both server and client machines that were run on limited-resource VMs. My 1024 documents had a random number of annotations between 1-10 inclusive. If you ran it on a production server and a physical workstation, I wouldn't be surprised if those times could be brought down under a second.

 

If you really need something more responsive than that, the SDK isn't going to be able to do it. Even if the server had an option to include annotation count as a system column, there would be a similar overhead since the server would have to perform this work.

 

Note that the amount of data transmitted here is fairly well minimized. No document pages, text, fields, or e-docs are sent. Only the annotations.

 

0 0

Replies

replied on March 17, 2014

There is no column that can be added to put that info into the search result listing. You'll have to get the DocumentInfo for each document in the search result and use GetAnnotations().Count to find the number of annotations on each document (that's assuming you're using RA. If you're using LFSO, the answer is the same, but the object and method names are different.). Is there any particular reason that you don't want to iterate through the documents?

0 0
replied on March 18, 2014

Hi Matthew, thanks for replying.

This is not a viable option in my eyes, when the search list returns upto and in excess of a 1000 documents, to retrieve the Annotation count in this way, would be a bottle neck. 

0 0
APPROVED ANSWER SELECTED ANSWER
replied on March 18, 2014 Show version history

In my tests it takes less than 2 seconds to run the iteration that you are talking about using this code:

SearchResultListing result = search.GetResultListing(settings);
IList<int> counts = new List<int>(result.RowCount);
foreach (EntryListingRow row in result)
{
    int id = int.Parse(row.GetDatumAsString(SystemColumn.Id),
        NumberStyles.AllowThousands);
    DocumentInfo info = new DocumentInfo(id, session);
    counts.Add(info.GetAnnotations().Count);
    info.Dispose();
}

I ran the benchmark using both server and client machines that were run on limited-resource VMs. My 1024 documents had a random number of annotations between 1-10 inclusive. If you ran it on a production server and a physical workstation, I wouldn't be surprised if those times could be brought down under a second.

 

If you really need something more responsive than that, the SDK isn't going to be able to do it. Even if the server had an option to include annotation count as a system column, there would be a similar overhead since the server would have to perform this work.

 

Note that the amount of data transmitted here is fairly well minimized. No document pages, text, fields, or e-docs are sent. Only the annotations.

 

0 0
replied on March 19, 2014

Hi Matthew, thanks for your time on this,

We have a Medical EMR product, used in several hospitals, with an average concurrent  1000 search transactions returning patient documents,

 

So to run this 1000 times for upto and over 1000 documents with upto 1000 annotations (quite common where they haven't structured their documents and have 500 plus pages) per document.

 

We also use the JRA not .net, so the implications of the addition is quite expensive.  

 

We are looking at externalising the count with a batch update instead.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.