Show / Hide Table of Contents

Interface IFreetextMatchCalculator

This is a utility class to perform an actual freetext search, for single or multiple words. It returns sets of ids that indicate the matches, and can also consolidate such sets into counts.

Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.dll
Syntax
public interface IFreetextMatchCalculator

Methods

CalculateMatchesAsync(string[], string[], int?, int?, bool, List<PartialMatches>, bool, CancellationToken)

Perform a freetext search and return the ids of the matching owners

Declaration
Task<Dictionary<int, List<int>>> CalculateMatchesAsync(string[] wordList, string[] owners, int? searchOp = null, int? hitLim = null, bool soundex = false, List<PartialMatches> partialMatches = null, bool strictSearch = false, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string[] wordList

Array of words to search for, with an implicit AND between them: ["foo", "bar"]

string[] owners

Array of owner table names to search: ["contact", "sale"]

int? searchOp

Override search operator: 1 = contains, 2 = starts with, 3 = exact match. Default to preference values

int? hitLim

Max number results to return. Defaults

bool soundex

Should we do SOUNDEX words instead of normal words?

List<PartialMatches> partialMatches

External storage for partial results

bool strictSearch

If true, then search main table only, not text or udefs

CancellationToken cancellationToken
Returns
Type Description
Task<Dictionary<int, List<int>>>

Dictionary indexed by owner entity table number; value is a dictionary of ids (with no subvalues, the dictionary class is used to ensure a unique id list)

Remarks

A match id list is built for each word, and the intersection of the lists calculated. The search terminates when all words have been processed, or when the intersection is empty.

Normal (non-cross table) search: all words must be found with-in a given owner. e.g. Search for "Foo bar" can find "Foo" in the contact.name and "bar" in the address table of the same contact.

Cross-table search: all words do not have to be found within a given owner. e.g. Search for "Foo bar" can find "Foo" in a contact, and "Bar" in a person record. The client needs to join the contact and person results to get the final results. Results are returned in two buckets: Pure results (all words found in entity) as the table number, and Partial results (some words found in entity) as the negative table number.

GroupMatches(Dictionary<int, List<int>>)

Consolidate a match list dictionary into a dictionary of owner table ids and counts

Declaration
Dictionary<int, int> GroupMatches(Dictionary<int, List<int>> matches)
Parameters
Type Name Description
Dictionary<int, List<int>> matches
Returns
Type Description
Dictionary<int, int>

TableNumberToLocalizedName(int)

Map the knwon, standard freetext owner entities into localized resources names

Declaration
string TableNumberToLocalizedName(int tableNumber)
Parameters
Type Name Description
int tableNumber
Returns
Type Description
string

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top