Skip to content

Instantly share code, notes, and snippets.

@Wesley-Lomax
Created July 30, 2015 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wesley-Lomax/4dcfe6b613fe6159a462 to your computer and use it in GitHub Desktop.
Save Wesley-Lomax/4dcfe6b613fe6159a462 to your computer and use it in GitHub Desktop.
Sitecore Glass Mapper and Solr BaseSearchResultItem
using System;
using System.ComponentModel;
using Glass.Mapper.Sc.Configuration;
using Glass.Mapper.Sc.Configuration.Attributes;
using System.Xml.Serialization;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Converters;
using Sitecore.Data;
using Sitecore.Data.Items;
namespace WesleyLomax.Common.Model.Base
{
[Serializable]
public abstract class BaseSearchResultItem
{
[SitecoreId]
[IndexField("_group")]
public virtual Guid Id { get; set; }
[SitecoreInfo(SitecoreInfoType.Language)]
[IndexField("_language")]
public virtual string Language { get; set; }
[TypeConverter(typeof(IndexFieldItemUriValueConverter))]
[XmlIgnore]
[IndexField("_uniqueid")]
public virtual ItemUri Uri { get; set; }
[SitecoreInfo(SitecoreInfoType.Version)]
public virtual int Version
{
get
{
return Uri == null ? 0 : Uri.Version.Number;
}
}
[IndexField("_name")]
public virtual string Name { get; set; }
[IndexField("_template")]
[TypeConverter(typeof(IndexFieldIDValueConverter))]
public virtual ID TemplateId { get; set; }
[IndexField("_uniqueid")]
public virtual string UniqueId { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment