This project is avaliable for download as a nuget package
PM> Install-Package NinjaNye.SearchExtensions
Soundex Searching
Soundex search allows you to search any number of
string
properties returning those that 'sounds like' any
of the given search terms. Soundex searches can be made against any
number of search terms.
Methods
The following methods are available to both
IQueryable
data and IEnumerable
data.
-
Soundex
- target property contains any of the search terms provided. -
ReverseSoundex
- target property contains all of the search terms provided.
As of Release 1.1, NinjaNye.SearchExtensions supports converting and searching for words that sound like a given word.
Performing Soundex
searches
Returning records that 'sound like' "test" using the Soundex algorythm
Search where a single property sounds like a single search term
var result = data.Search(x => x.Property1).Soundex("test")
Search where a any of multiple properties sounds like a single search term
var result = data.Search(x => x.Property1, x => x.PropertyTwo)
.Soundex("test")
Search where a single property sounds like any one of multiple search terms
var result = data.Search(x => x.Property1)
.Soundex("test", "another")
Search where a any of multiple properties sounds like any of multiple search terms
var result = data.Search(x => x.Property1, x => x.PropertyTwo)
.Soundex("test", "another")
Performing ReverseSoundex
searches
The reverse soundex algorithm is calculated in the same way as the soundex code, the difference being that the word is reversed before the code is calculated.
Search where a single property sounds like a single search term based on the reverse soundex algorythm.
var result = data.Search(x => x.Property1).ReverseSoundex("test")
Search where a any of multiple properties sounds like a single search term based on the reverse soundex algorythm.
var result = data.Search(x => x.Property1, x => x.PropertyTwo)
.ReverseSoundex("test")
Search where a single property sounds like any one of multiple search terms based on the reverse soundex algorythm.
var result = data.Search(x => x.Property1)
.ReverseSoundex("test", "another")
Search where a any of multiple properties sounds like any of multiple search terms based on the reverse soundex algorythm.
var result = data.Search(x => x.Property1, x => x.PropertyTwo)
.ReverseSoundex("test", "another")
The above methods can be applied to
IQueryable
data. ForIQueryable
we reduce the amount of records returned from the data source as much as possible but be aware that the soundex searching is performed on the in memory collection.
For more information about the Soundex search functionality, soundex
search performance, and how it has been integrated with
IQueryable
, please visit
http://jnye.co/soundex
If you have any new feature requests, questions, or comments, please get in touch, either, via my website, through twitter: @ninjanye or by creating an issue through the projects github page .