logo

Implementation of the eql-search for documents

Let's see how to implement the eql-search for the document.

For example, let's add the "EqlStr" attribute of the "string" type to the document type "File" (Fig. 1). On the "Advanced" tab, select the attribute "Participates in search (filter)" (Fig. 2).

 

Fig. 1

Fig.2

 

Add a new class to the script module:

public class FileManager : DocumentManager<IFileConfigExt, long>
    {
        public static FileManager Instance
        {
            get { return Locator.GetServiceNotNull<FileManager>(); }
        }
        public override void SetupFilter(ICriteria criteria, IEntityFilter filter)
        {
            var eqlDocExtFilter = filter as IFileConfigExtFilter;
            if (eqlDocExtFilter != null)
            {
                if (!String.IsNullOrEmpty(eqlDocExtFilter.EQLStr))
                    SetupFilterQuery(criteria, eqlDocExtFilter.EQLStr);
            }
            base.SetupFilter(criteria, filter);
        }
    }

And:

using EleWise.ELMA.Documents.Models;
using EleWise.ELMA.Documents.Managers;
using NHibernate;

After publishing the document and restarting the server, the filter of the "File" document will have an additional field «EQLStr» (Fig. 3), where you can type an eql-query.


Fig. 3

Note
  1. The EQL-queries Designer will not be available for this implementation.
  2. The eql-search is implemented only for one document type (it's not applicable to the heirs).