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

Exibir arquivo Open project: sillsdev/FieldWorks Class Usage Examples

Protected Methods

Method Description
CollectPossibleMatchIn ( string searchIn, ICmSemanticDomain domain, int wholeWordBucket ) : bool

Take a string to look in (from a domain's Name or ExampleWords) and try to find a match for some (strategy-defined) search key(s).

DoesInputMatchWord ( IEnumerable wordsToLookIn ) : MatchingResult

Each strategy defines how to determine whether a string has a match or not.

GetDomainNameString ( ICmSemanticDomain domain ) : string

Get the text from a Semantic Domain's Name field. This version uses BestAnalysisAlternative which should always have a value, but a subclass might use a more specific writing system which may not have a value (i.e. be prepared for a null return value).

GetExampleWordTextFromDomainQuestion ( ICmDomainQ questionObject ) : string

For one Semantic Domain question, return the text of the Example Words field. This baseclass version uses BestAnalysis, which always has a value, but a subclass might use a more specific writing system which could return a null value (i.e. be prepared to handle a null return value).

GetExampleWordsString ( IEnumerable questions ) : string

Takes a list of semantic domain question objects and fishes out the example words and puts them in a space-delimited string for easier searching. This version uses BestAnalysisAlternative.

LookForHitInWordCollection ( IEnumerable wordsToLookIn, string key ) : MatchingResult

Search through a list of words (results of Regex match) for a search key. Return a MatchingResult to inform caller of type of match, if any.

SemDomSearchStrategy ( FdoCache cache ) : System

Constructor for new search strategy.

SetupSearchResults ( ) : void

Subclasses can override to set the search results object to have the correct number of buckets for a different strategy. Baseclass defaults to two buckets.

Private Methods

Method Description
GetAppropriateCultureInfo ( ) : CultureInfo
ParseStringIntoWords ( string searchIn ) : IEnumerable
PutDomainInDesiredBucket ( ICmSemanticDomain domain ) : void

Subclasses can override this method to change how Semantic Domains are compared with any search key(s) and the priority types of matches for putting the domain into an appropriate search results bucket (if any). N.B. Strategy subclasses should take care not to add a domain to a bucket if it is already in a higher priority bucket.

Method Details

CollectPossibleMatchIn() protected method

Take a string to look in (from a domain's Name or ExampleWords) and try to find a match for some (strategy-defined) search key(s).
protected CollectPossibleMatchIn ( string searchIn, ICmSemanticDomain domain, int wholeWordBucket ) : bool
searchIn string
domain ICmSemanticDomain
wholeWordBucket int
return bool

DoesInputMatchWord() protected abstract method

Each strategy defines how to determine whether a string has a match or not.
protected abstract DoesInputMatchWord ( IEnumerable wordsToLookIn ) : MatchingResult
wordsToLookIn IEnumerable
return MatchingResult

GetDomainNameString() protected method

Get the text from a Semantic Domain's Name field. This version uses BestAnalysisAlternative which should always have a value, but a subclass might use a more specific writing system which may not have a value (i.e. be prepared for a null return value).
protected GetDomainNameString ( ICmSemanticDomain domain ) : string
domain ICmSemanticDomain
return string

GetExampleWordTextFromDomainQuestion() protected method

For one Semantic Domain question, return the text of the Example Words field. This baseclass version uses BestAnalysis, which always has a value, but a subclass might use a more specific writing system which could return a null value (i.e. be prepared to handle a null return value).
protected GetExampleWordTextFromDomainQuestion ( ICmDomainQ questionObject ) : string
questionObject ICmDomainQ
return string

GetExampleWordsString() protected method

Takes a list of semantic domain question objects and fishes out the example words and puts them in a space-delimited string for easier searching. This version uses BestAnalysisAlternative.
protected GetExampleWordsString ( IEnumerable questions ) : string
questions IEnumerable
return string

LookForHitInWordCollection() protected method

Search through a list of words (results of Regex match) for a search key. Return a MatchingResult to inform caller of type of match, if any.
protected LookForHitInWordCollection ( IEnumerable wordsToLookIn, string key ) : MatchingResult
wordsToLookIn IEnumerable
key string
return MatchingResult

SemDomSearchStrategy() protected method

Constructor for new search strategy.
protected SemDomSearchStrategy ( FdoCache cache ) : System
cache FdoCache
return System

SetupSearchResults() protected method

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