Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
RavenDB Index: Instance field 'flags' is not defined for type 'System.Decimal'

RavenDB Index fails when I use decimal properties and I can't figure out why.

My Index:

public class MyIndex : AbstractIndexCreationTask<MyDocument>
{
    public class Result
    {
        public string Id { get; set; } = string.Empty;
        public decimal? PreviousPrice { get; set; }
        public decimal? CurrentPrice { get; set; }
    }

    public NavEntriesIndex()
    {
        Map = entries =>
            from entry in entries
            select new Result
            {
                Id = entry.Id,
                PreviousPrice = entry.PreviousPriceMovement.Price,
                CurrentPrice = entry.PriceMovement.Price,
            };

        StoreAllFields(FieldStorage.Yes);
    }
}

The error:

Failed to execute mapping function on 7cb4e8c7-2807-4dd2-9b42-98938acfa11f. Exception: System.TypeInitializationException: The type initializer for 'Sparrow.Utils.DecimalHelper' threw an exception.

---> System.ArgumentException: Instance field 'flags' is not defined for type 'System.Decimal'

at System.Linq.Expressions.Expression.Field(Expression expression, String fieldName)

at Sparrow.Utils.DecimalHelper.CreateIsDoubleMethod() in C:\Builds\RavenDB-Stable-4.2\42046\src\Sparrow\Utils\DecimalHelper.cs:line 25

at Sparrow.Utils.DecimalHelper..ctor() in C:\Builds\RavenDB-Stable-4.2\42046\src\Sparrow\Utils\DecimalHelper.cs:line 18

at Sparrow.Utils.DecimalHelper..cctor() in C:\Builds\RavenDB-Stable-4.2\42046\src\Sparrow\Utils\DecimalHelper.cs:line 12

--- End of inner exception stack trace ---

at Raven.Server.Json.BlittableNumber.Parse(Object value, Double& doubleResult, Int64& longResult) in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Json\BlittableNumber.cs:line 55

at Raven.Server.Documents.Indexes.Persistence.Lucene.Documents.LuceneDocumentConverterBase.GetOrCreateNumericField(IndexField field, Object value, Store storage, TermVector termVector)+MoveNext() in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Documents\Indexes\Persistence\Lucene\Documents\LuceneDocumentConverterBase.cs:line 595

at Raven.Server.Documents.Indexes.Persistence.Lucene.Documents.LuceneDocumentConverterBase.GetRegularFields[T](T instance, IndexField field, Object value, JsonOperationContext indexContext, Boolean& shouldSkip, Boolean nestedArray) in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Documents\Indexes\Persistence\Lucene\Documents\LuceneDocumentConverterBase.cs:line 408

at Raven.Server.Documents.Indexes.Persistence.Lucene.Documents.AnonymousLuceneDocumentConverter.GetFields[T](T instance, LazyStringValue key, Object document, JsonOperationContext indexContext, IWriteOperationBuffer writeBuffer) in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Documents\Indexes\Persistence\Lucene\Documents\AnonymousLuceneDocumentConverter.cs:line 57

at Raven.Server.Documents.Indexes.Persistence.Lucene.Documents.LuceneDocumentConverterBase.SetDocument(LazyStringValue key, Object document, JsonOperationContext indexContext, IWriteOperationBuffer writeBuffer, Boolean& shouldSkip) in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Documents\Indexes\Persistence\Lucene\Documents\LuceneDocumentConverterBase.cs:line 105

at Raven.Server.Documents.Indexes.Persistence.Lucene.IndexWriteOperation.IndexDocument(LazyStringValue key, Object document, IndexingStatsScope stats, JsonOperationContext indexContext) in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Documents\Indexes\Persistence\Lucene\IndexWriteOperation.cs:line 127

at Raven.Server.Documents.Indexes.MapIndexBase`2.HandleMap(LazyStringValue lowerId, LazyStringValue id, IEnumerable mapResults, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats) in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Documents\Indexes\MapIndexBase.cs:line 68

at Raven.Server.Documents.Indexes.Workers.MapDocuments.Execute(DocumentsOperationContext databaseContext, TransactionOperationContext indexContext, Lazy`1 writeOperation, IndexingStatsScope stats, CancellationToken token) in C:\Builds\RavenDB-Stable-4.2\42046\src\Raven.Server\Documents\Indexes\Workers\MapDocuments.cs:line 107

Any Idea?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!