C# Class SIL.FieldWorks.FDO.DomainServices.SemanticDomainSearch.WholeAndPartialNameMatchSearchStrategy

Search strategy for when the user types a string and we need to search the Semantic Domain list for matches of that string.
Inheritance: SemDomSearchStrategy
Mostra file Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
WholeAndPartialNameMatchSearchStrategy ( FdoCache cache, string searchKey ) : System

Semantic Domain Search Strategy for finding: 1) bucket 0 will contain: Partial or complete matches, left to right of Abbreviation (hierarchical number) Note when matches are found for this then the other buckets should be empty because this is a number vs alphabet 2a) bucket 0 This is the bucket for an EXACT match found for the DomainNameString 2a) bucket 1 This is the bucket for whole word matches found in the DomainNameString 2b) bucket 2 This is the bucket for whole word matches found in the ExampleWordsString 2c) bucket 3 This is the bucket for partial(StartsWith) word matches found in the DomainNameString 2d) bucket 4 This is the bucket for partial(StartsWith) word matches found in the ExampleWordsString Note: The order of these buckets is very important due to the behavior found in the method AddResultToBucketX

Protected Methods

Method Description
DoesInputMatchWord ( IEnumerable wordsToLookIn ) : MatchingResult

This strategy only uses one search string (what the user typed), so this version is pretty simple.

SetupSearchResults ( ) : void

Subclasses can override to set the search results object to have the correct number of buckets for a different strategy. This strategy needs three buckets.

Private Methods

Method Description
PutDomainInDesiredBucket ( ICmSemanticDomain domain ) : void

This implementation checks to see of the search key starts with a digit first. If so, it looks in the Abbreviation field for a search key match in the hierarchical number (e.g. "8.3.3"; these would go in the first bucket). Otherwise it checks next for matches where the key corresponds to the beginning of the Name field (first bucket). Failing that, it checks for whole word (second bucket) or partial matches (third bucket) between the search key and the contents of a Semantic Domain's Name and ExampleWords fields. N.B. Strategy subclasses should take care not to add a domain to a bucket if it is already in a higher priority bucket.

SearchInAbbreviationForMatches ( ICmSemanticDomain domain ) : void

Method Details

DoesInputMatchWord() protected method

This strategy only uses one search string (what the user typed), so this version is pretty simple.
protected DoesInputMatchWord ( IEnumerable wordsToLookIn ) : MatchingResult
wordsToLookIn IEnumerable
return MatchingResult

SetupSearchResults() protected method

Subclasses can override to set the search results object to have the correct number of buckets for a different strategy. This strategy needs three buckets.
protected SetupSearchResults ( ) : void
return void

WholeAndPartialNameMatchSearchStrategy() public method

Semantic Domain Search Strategy for finding: 1) bucket 0 will contain: Partial or complete matches, left to right of Abbreviation (hierarchical number) Note when matches are found for this then the other buckets should be empty because this is a number vs alphabet 2a) bucket 0 This is the bucket for an EXACT match found for the DomainNameString 2a) bucket 1 This is the bucket for whole word matches found in the DomainNameString 2b) bucket 2 This is the bucket for whole word matches found in the ExampleWordsString 2c) bucket 3 This is the bucket for partial(StartsWith) word matches found in the DomainNameString 2d) bucket 4 This is the bucket for partial(StartsWith) word matches found in the ExampleWordsString Note: The order of these buckets is very important due to the behavior found in the method AddResultToBucketX
public WholeAndPartialNameMatchSearchStrategy ( FdoCache cache, string searchKey ) : System
cache FdoCache
searchKey string This strategy expects to only have one search key string.
return System