public class Tests
{
[Test]
public void QueryById()
{
var documentStore = new DocumentStore() { Url = "
http://localhost:8081", Conventions = { DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites } };
documentStore.Initialize();
IndexCreation.CreateIndexes(typeof(SomeDocumentIndex).Assembly, documentStore);
}
}
public class SomeDocument
{
public string Id { get; set; }
public string Text { get; set; }
}
public enum SomeEnum
{
Value1 = 1,
Value2 = 2
}
public class SomeDocumentIndex : AbstractIndexCreationTask<SomeDocument, SomeDocumentIndex.IndexResult>
{
public class IndexResult
{
public string Id { get; set; }
public SomeEnum SomeEnum { get; set; }
}
public SomeDocumentIndex()
{
Map = docs => from doc in docs
select new { Id = doc.Id, SomeEnum = SomeEnum.Value1 };
Store(x => x.SomeEnum, FieldStorage.Yes);
}
}