### Perform StartsWith Search on Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this snippet to search where any of multiple properties start with a single search term. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2, x => x.Property3) .StartsWith("searchTerm"); ``` -------------------------------- ### Perform StartsWith Search with Multiple Terms on Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this snippet to search where any of multiple properties start with any of multiple search terms. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2, x => x.Property3) .StartsWith("searchTerm1", "searchTerm2", "searchTerm3"); ``` -------------------------------- ### Perform StartsWith Search on Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this snippet to search where a single property starts with a single search term. ```csharp var result = queryableData.Search(x => x.Property1) .StartsWith("searchTerm"); ``` -------------------------------- ### Perform StartsWith Search with Multiple Terms on Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this snippet to search where a single property starts with any of multiple search terms. ```csharp var result = queryableData.Search(x => x.Property1) .StartsWith("search", "term"); ``` -------------------------------- ### Perform IEnumerable Searches with Multiple String Comparisons Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Demonstrates chaining multiple search operations on an IEnumerable collection, including setting the culture for each comparison. Ensure the desired StringComparison is set before each search method. ```csharp var result = enumerableData.Search(x => x.Property1) .SetCulture(StringComparison.OrdinalIgnoreCase) // Set culture for comparison .StartsWith("abc") .EndsWith("xyz") .Containing("mno"); ``` -------------------------------- ### Combine StartsWith and Containing Searches Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Combine StartsWith and Containing search actions on a single property. This snippet demonstrates chaining multiple search instructions. ```csharp var result = queryableData.Search(x => x.Property1) .StartsWith("abc") .Containing("mno"); ``` -------------------------------- ### Mixing Ranked Search with Other Fluent API Methods Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Combines `StartsWith`, `Containing`, and `ToRanked` methods to perform a complex ranked search, then orders and takes the top 10 results. ```csharp var result = context.Users.Search(x => x.FirstName, x => x.LastName, x.MiddleName) .StartsWith("john") .Containing("nye") .ToRanked() .OrderByDescending(r => r.Hits) // Order by Hits property of IRanked .Take(10); ``` -------------------------------- ### Soundex Search: Multiple Properties, Multiple Terms Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this method to find records where any of the specified properties' Soundex values match any of the provided search terms. This offers the most flexible search across multiple fields and terms. ```csharp var result = data.SoundexOf(x => x.Property1, x => x.PropertyTwo) .Matching("test", "another") ``` -------------------------------- ### Retrieve Top 10 Relevant Search Results Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use ranked search to find users with 'John' in their name, order by relevance (hit count), and take the top 10 results. ```csharp var result = context.Users.Search(x => x.FirstName, x => x.LastName, x.MiddleName) .Containing("John") .ToRanked() .OrderByDescending(r => r.Hits) // Order by Hits property of IRanked .Take(10); ``` -------------------------------- ### Perform OR Containing Search on First Set, AND with Second Set Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to search for a term in either of the first set of properties, AND a term in either of the second set of properties. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2) .Containing("searchTerm") .Search(x => x.Property3, x => x.Property4) .Containing("searchTerm"); ``` -------------------------------- ### Perform OR Containing Search on First Set, AND with Multiple Terms on Second Set Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to search for a term in either of the first set of properties, AND any of multiple terms in the second property. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2) .Containing("searchTerm") .Search(x => x.Property3) .Containing("another", "term"); ``` -------------------------------- ### Perform AND Containing Search on Different Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to ensure a term exists in one property AND another term exists in another property. ```csharp var result = queryableData.Search(x => x.Property1) .Containing("searchTerm1") .Search(x => x.Property1) .Containing("searchTerm2"); ``` -------------------------------- ### Ranked Search Multiple Terms, Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Perform a ranked search for multiple terms across multiple specified properties. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2) .Containing("searchTerm1", "searchTerm2", "searchTerm3") .ToRanked(); ``` -------------------------------- ### Switch StringComparison Culture Context Multiple Times in IEnumerable Search Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Illustrates how to change the StringComparison culture context multiple times within a single IEnumerable search chain. Each SetCulture call affects subsequent search operations. ```csharp var result = enumerableData.Search(x => x.Property1) .SetCulture(StringComparison.OrdinalIgnoreCase) .StartsWith("abc") // Uses OrdinalIgnoreCase .SetCulture(StringComparison.Ordinal) .EndsWith("xyz") // Uses Ordinal .SetCulture(StringComparison.CurrentCulture) .Containing("mno"); //Uses CurrentCulture ``` -------------------------------- ### Combine Multiple StartsWith and Containing Searches Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Combine multiple search terms for both StartsWith and Containing operations across multiple properties. This snippet shows advanced chaining capabilities. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2) // that starts with "abc" OR "ninja" .StartsWith("abc", "ninja") // and contains "xyz" OR "extensions" .Containing("xyz", "extensions") ``` -------------------------------- ### Soundex Search: Single Property, Single Term Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this method to find records where a single property's Soundex value matches a single search term. Ensure the Soundex extension is imported. ```csharp var result = data.SoundexOf(x => x.Property1).Matching("test") ``` -------------------------------- ### Soundex Search: Multiple Properties, Single Term Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this method to find records where any of the specified properties' Soundex values match a single search term. This is useful for searching across several fields simultaneously. ```csharp var result = data.SoundexOf(x => x.Property1, x => x.PropertyTwo) .Matching("test") ``` -------------------------------- ### Perform IsEqual Search with Multiple Terms on Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to find records where any of the specified properties exactly match any of the specified search terms. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2, x => x.Property3) .IsEqual("searchTerm1", "searchTerm2", "searchTerm3"); ``` -------------------------------- ### Reverse Soundex Search: Multiple Properties, Single Term Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this method to find records where any of the specified properties' Reverse Soundex values match a single search term. This applies the Reverse Soundex algorithm across multiple fields. ```csharp var result = data.ReverseSoundexOf(x => x.Property1, x => x.PropertyTwo) .Matching("test") ``` -------------------------------- ### Reverse Soundex Search: Single Property, Single Term Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this method to find records where a single property's Reverse Soundex value matches a single search term. This is an alternative to the standard Soundex algorithm. ```csharp var result = data.ReverseSoundexOf(x => x.Property1).Matching("test") ``` -------------------------------- ### Soundex Search: Single Property, Multiple Terms Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this method to find records where a single property's Soundex value matches any of the provided search terms. This allows for broader matching on a specific field. ```csharp var result = data.SoundexOf(x => x.Property1).Matching("test", "another") ``` -------------------------------- ### IRanked Interface Definition Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Defines the structure for ranked search results, including the number of hits and the matched item. ```csharp public interface IRanked { int Hits { get; } T Item { get; } } ``` -------------------------------- ### Perform IsEqual Search on Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to find records where any of the specified properties exactly match a single search term. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2, x => x.Property3) .IsEqual("searchTerm"); ``` -------------------------------- ### Ranked Search Single Term, Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Perform a ranked search for a single term across multiple specified properties. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2, x => x.Property3) .Containing("searchTerm") .ToRanked(); ``` -------------------------------- ### Perform Containing Search with Multiple Terms on Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to search for any of multiple terms across multiple properties. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2, x => x.Property3) .Containing("searchTerm1", "searchTerm2", "searchTerm3"); ``` -------------------------------- ### Perform Containing Search on Multiple Properties Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to search for a single term across multiple properties. ```csharp var result = queryableData.Search(x => x.Property1, x => x.Property2, x => x.Property3) .Containing("searchTerm"); ``` -------------------------------- ### Perform IsEqual Search on Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to find records where a single property exactly matches a single search term. ```csharp var result = queryableData.Search(x => x.Property1) .IsEqual("searchTerm"); ``` -------------------------------- ### Ranked Search Multiple Terms, Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Perform a ranked search for multiple terms within a single specified property. ```csharp var result = queryableData.Search(x => x.Property1) .Containing("searchTerm1", "searchTerm2", "searchTerm3") .ToRanked(); ``` -------------------------------- ### Perform IsEqual Search with Multiple Terms on Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to find records where a single property exactly matches any of the specified search terms. ```csharp var result = queryableData.Search(x => x.Property1) .IsEqual("search", "term"); ``` -------------------------------- ### Perform Containing Search with Multiple Terms on Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to search for any of multiple terms within a single property. ```csharp var result = queryableData.Search(x => x.Property1) .Containing("search", "term"); ``` -------------------------------- ### Perform Containing Search on Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Use this to search for a single term within a single property of your data. ```csharp var result = queryableData.Search(x => x.Property1) .Containing("searchTerm"); ``` -------------------------------- ### Ranked Search Single Term, Single Property Source: https://github.com/ninjanye/searchextensions/blob/master/README.md Perform a ranked search for a single term within a single property of a collection. ```csharp var result = queryableData.Search(x => x.Property1) .Containing("searchTerm") .ToRanked(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.