How to configure search filters in Spotter extensions
The class GtSpotterFiltersConfiguration
allows users to specify custom configurations for search filters.
One usage is for searches for class names in the extension GtSpotterStart>>#gtSearchForClassesFor:
.
GtSpotterFiltersConfiguration default
Below is the current default configuration for class searches. This splits the query into words by capitalization and the matching of each word is case sensitive in case the first letter is uppercase.
GtSpotterFiltersConfiguration default putSubstringsConfigurationWithId: #classSearch with: [ :aSubstringsConfiguration | aSubstringsConfiguration withWordsSplitter; beCaseSensitiveByCapitalization ]
An example of a configuration where the query is split by space and asterisk, and the matching of each word is case sensitive in case the first letter is uppercase.
GtSpotterFiltersConfiguration default putSubstringsConfigurationWithId: #classSearch with: [ :aSubstringsConfiguration | aSubstringsConfiguration withCharacterSplitterBy: (Array with: Character space with: $*); beCaseSensitiveByCapitalization ]
Using just spaces to separate query words and using case insensitive matching for each one.
GtSpotterFiltersConfiguration default putSubstringsConfigurationWithId: #classSearch with: [ :aSubstringsConfiguration | aSubstringsConfiguration withCharacterSplitter; beCaseInsensitive ]
Splitting by capitalization and using case insensitive matching for each query word.
GtSpotterFiltersConfiguration default putSubstringsConfigurationWithId: #classSearch with: [ :aSubstringsConfiguration | aSubstringsConfiguration withWordsSplitter; beCaseInsensitive ]
GtSpotterFiltersConfiguration default removeConfigurationWithId: #classSearch
The substrings filter splits a query into words. There are currently two available splitters:
GtSpotterByWordsQuerySplitter
GtSpotterByCharacterQuerySplitter
The character splitter in GtSpotterByCharacterQuerySplitter
takes a list of characters by which it splits the query into words. By default space is used
splitter := GtSpotterByCharacterQuerySplitter new.
splitter splitQueryString: 'one two three'
The splitter GtSpotterByWordsQuerySplitter
splits by camel case, and also when there are non letter characters.
splitter := GtSpotterByWordsQuerySplitter new.
splitter splitQueryString: 'OneTwoThree'
splitter splitQueryString: 'one two three'
splitter splitQueryString: 'ONeTwoThree3 Four fiveSix'
splitter splitQueryString: 'One***Two---Three!@$Four'