Created
February 29, 2016 20:10
-
-
Save RyanABailey/8b736bab18870bea66b8 to your computer and use it in GitHub Desktop.
Lucene search code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Expression<Func<SearchModel, bool>> GetSearchPredicate(string searchTerm) | |
| { | |
| var predicate = PredicateBuilder.True<SearchModel>(); // Items which meet the predicate | |
| // search logic cut down | |
| predicate = predicate.Or(x => x.DispalyName.Like(searchTerm)).Boost(60); | |
| // Only show items which are not excluded from search | |
| predicate = predicate.And(x => x.ExcludeFromSearch == false); | |
| return predicate; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment