Created
September 6, 2014 16:15
-
-
Save mattgartman/d92bd9621dff0f1cd704 to your computer and use it in GitHub Desktop.
SolrDateBoost: Search Code
This file contains 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
var indexName = string.Format("sitecore_{0}_index", Sitecore.Context.Database.Name); | |
var searchIndex = ContentSearchManager.GetIndex(indexName); | |
using (var context = searchIndex.CreateSearchContext()) | |
{ | |
var dateBoostPredicate = PredicateBuilder.True<SearchResultItemModel>(); | |
dateBoostPredicate = dateBoostPredicate.And(x => x._val_ == "recip(ms(NOW, publicationdate_tdt), 3.16e-11, 1, 1)"); | |
context.GetQueryable<SearchResultItemModel>() | |
.Where(result => result.Name.Contains("A")) | |
.Where(dateBoostPredicate) | |
.GetResults(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment