Skip to content

Instantly share code, notes, and snippets.

@mattgartman
mattgartman / Sitecore.HeartBeatExcludes.config
Last active August 29, 2015 14:07
Sitecore.HeartBeatExcludes.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<!-- EXCLUDE CONNECTION STRINGS FROM HEART BEAT CHECK
Excludes specific connection strings from the heart beat check.
Values are Pipe (|) delimited and not case sensitive
Example: activedirectory|otherNonSQLconnectionString
Default value: not defined
-->
@mattgartman
mattgartman / SolrDateBoost: Search Log
Created September 6, 2014 16:30
SolrDateBoost: Search Log
11020 12:21:21 INFO Query - (_name:(*A*) AND _val_:("recip\(ms\(NOW, publicationdate_tdt\), 3.16e\-11, 1, 1\)"))
11020 12:21:21 INFO Serialized Query - ?q=(_name:(*A*) AND _val_:("recip\(ms\(NOW, publicationdate_tdt\), 3.16e\-11, 1, 1\)"))&rows=500&fl=*,score&fq=_indexname:(sitecore_web_index)
@mattgartman
mattgartman / SolrDateBoost: Search Code
Created September 6, 2014 16:15
SolrDateBoost: Search Code
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)");
@mattgartman
mattgartman / SolrDateBoost: Search Model
Last active August 29, 2015 14:06
SolrDateBoost: Search Model
public class SearchResultItemModel : Sitecore.ContentSearch.SearchTypes.SearchResultItem
{
[IndexField("_val_")]
public string _val_ { get; set; }
//custom publication date field defined in the Sitecore data template
[IndexField("PublicationDate")]
public DateTime PublicationDate { get; set; }
}
@mattgartman
mattgartman / LINQPadQuery
Created June 13, 2013 18:55
Using LINQPad with Sitecore 7 and Solr
// IoC container
public IWindsorContainer container;
public class Test :SearchResultItem
{
public ItemUri Uri {get;set;}
public string Testing {get;set;}
}