Indexing static data types

One can make a custom data type searchable, by using [SearchableType] and [SearchableField] attributes.

namespace Composite.Community.Blog
{
    [ImmutableTypeId("…")]
    //…
    [SearchableType]
    public interface Tags : IData, …
    {
        ….
        
        [ImmutableFieldId("…")]
        // ….
        [SearchableField(true, false, false)]
        string Tag { get; set; }
    }
}

The [SearchableField(...)] attribute receives the following parameters:

    [AttributeUsage(AttributeTargets.Property)]
    public sealed class SearchableFieldAttribute : Attribute
    {
        public SearchableFieldAttribute(bool indexText, bool previewable, bool faceted);
    }

indexText  – Indicates whether a field’s value will be a part of the full-text search. Applicable only for the string/XhtmlDocument fields.

previewable – Indicates whether the value will be preserved with the document in the index and should appear in the search results view. For numeric values, date times and strings no longer than 64 characters, the field will also be searchable.

faceted – indicates whether the faceted search feature should be enabled for the field. If the field contains multiple values (f.e. comma separated GUID-s), one can register a field processor to implement the tokenization.