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

Question

Question

SDK - Calculating Electronic File Size for Search Results

asked on November 24, 2015

Hi all,

I'm trying to calculate the total size on the volume for the entries that are returned from a search, using the SDK. Obviously there is the DocumentInfo.ElecDocumentSize property but I'd prefer not to loop through search results due to the time it will take to do this for larger searches. Is there a time-efficient way to do this?

I'm essentiallty wanting to access the same functionality that exists in the client when a user selects their search results and clicks File > Calculate Sizes.

Any help is much appreciated.

0 0

Answer

SELECTED ANSWER
replied on November 24, 2015

In the SDK documentation, there is a class called "SearchStatistics" if you are using .Net RA. This will get you exactly what you need. Let me know if you need some code examples.

2 0
replied on November 25, 2015

Thanks again, Chris. You've been a big help!

I really just needed to know that the class existed, I've got it working now.

0 0
replied on January 29, 2019

Hi Chris,

I'm looking to do the same, but could do with some examples to help me get started. Are you able to help? smiley

Cheers!

0 0
replied on January 30, 2019

Following this also.

0 0
replied on February 7, 2019 Show version history

Sure! Here's an example with a custom search syntax. Just pop that in an SDK script in workflow and change your parameters. This example sets a token value created in the workflow called "SearchDocumentCount" to return something meaningful.

 

namespace WorkflowActivity.Scripting.SearchStats
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.RepositoryAccess;

    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class Script1 : RAScriptClass102
    {
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {
            // Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
            Search search = new Search(RASession,"{LF:AssociatedPages=\"YES\"} & ({LF:OCR=\"none\"} | {LF:OCR=\"some\"}) -({[Fuel]:[Type-Fuel Transaction]=\"BOL\"})");
            search.Run();
            SearchStatistics stats = search.GetSummaryStats();
            int searchdocumentcount = stats.DocumentCount;
            int pagecount = stats.PageCount;
            long eletronicfilesize = stats.ElectronicFileSize;
            int foldercount = stats.FolderCount;
            long imagefilesize = stats.ImageFileSize;
            long textfilesize = stats.TextFileSize;
            SetTokenValue("SearchDocumentCount",searchdocumentcount);
        }
    }
}

 

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.