Null Reference Exception when querying

41 views
Skip to first unread message

Nick

unread,
Jun 22, 2017, 5:15:38 AM6/22/17
to RavenDB - 2nd generation document database
Hi,

I am getting the following error pretty frequently, any ideas whats causing it?

The index definition is pretty simple

public class QueryAnalytics : AbstractIndexCreationTask<QueryAnalytic>
    {
        public QueryAnalytics()
        {
            Map = analytics =>
                from analytic in analytics
                select new
                    {
                        analytic.Query,
                        analytic.TimesQueried,
                        analytic.ResultCount,
                        analytic.LastQueryUtc,
                        analytic.Gender
                    };

            Store(a => a.Query, FieldStorage.Yes);
            Store(a => a.ResultCount, FieldStorage.Yes);

            Indexes.Add(a => a.Query, FieldIndexing.Analyzed);
            Analyzers.Add(x => x.Query, "Lucene.Net.Contrib.NGramAnalyzer.NGramAnalyzer, Lucene.Net.Contrib.NGramAnalyzer");

            Sort(e => e.TimesQueried, SortOptions.Int);
            Sort(e => e.ResultCount, SortOptions.Int);
        }
    }

Url: "/databases/Marketplace/indexes/QueryAnalytics?&query=%20Query%3A%28ba%29&pageSize=10&fetch=Query&fetch=ResultCount&sort=-TimesQueried_Range&sort=-ResultCount_Range&SortHint-TimesQueried_Range=Int&SortHint-ResultCount_Range=Int"

System.NullReferenceException: Object reference not set to an instance of an object.
   at Raven.Database.Indexing.ParenthesistLuceneASTNode.ToGroupFieldQuery(LuceneASTQueryConfiguration configuration) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Indexing\LuceneAST.cs:line 692
   at Raven.Database.Indexing.QueryBuilder.BuildQuery(String query, IndexQuery indexQuery, RavenPerFieldAnalyzerWrapper analyzer) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Indexing\QueryBuilder.cs:line 66
   at Raven.Database.Indexing.Index.IndexQueryOperation.GetDocumentQuery(String query, IndexQuery indexQuery) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Indexing\Index.cs:line 1760
   at Raven.Database.Indexing.Index.IndexQueryOperation.GetDocumentQuery() in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Indexing\Index.cs:line 1718
   at Raven.Database.Indexing.Index.IndexQueryOperation.<Query>d__17.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Indexing\Index.cs:line 1406
   at Raven.Database.Util.ActiveEnumerable`1..ctor(IEnumerable`1 enumerable) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Util\ActiveEnumerable.cs:line 16
   at Raven.Database.Actions.QueryActions.DatabaseQueryOperation.Init() in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Actions\QueryActions.cs:line 254
   at Raven.Database.Actions.QueryActions.<>c__DisplayClass2_1.<Query>b__0(IStorageActionsAccessor accessor) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Actions\QueryActions.cs:line 117
   at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1 action, EsentTransactionContext transactionContext) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Storage\Esent\TransactionalStorage.cs:line 932
   at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Storage\Esent\TransactionalStorage.cs:line 877
   at Raven.Database.Actions.QueryActions.Query(String index, IndexQuery query, CancellationToken externalCancellationToken) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Actions\QueryActions.cs:line 108
   at Raven.Database.Server.Controllers.IndexController.PerformQueryAgainstExistingIndex(String index, IndexQuery indexQuery, Etag& indexEtag, HttpResponseMessage msg, CancellationToken token) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Server\Controllers\IndexController.cs:line 729
   at Raven.Database.Server.Controllers.IndexController.ExecuteQuery(String index, Etag& indexEtag, HttpResponseMessage msg, CancellationToken token) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Server\Controllers\IndexController.cs:line 680
   at Raven.Database.Server.Controllers.IndexController.GetIndexQueryResult(String index, CancellationToken token) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Server\Controllers\IndexController.cs:line 651
   at Raven.Database.Server.Controllers.IndexController.IndexGet(String id) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Server\Controllers\IndexController.cs:line 202
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
at Raven.Client.Connection.ReplicationInformerBase`1.<TryOperationAsync>d__34`1.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Client.Lightweight\Connection\ReplicationInformerBase.cs:line 446 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Raven.Client.Connection.ReplicationInformerBase`1.<ExecuteWithReplicationAsync>d__33`1.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Client.Lightweight\Connection\ReplicationInformerBase.cs:line 316 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Raven.Client.Connection.Async.AsyncServerClient.<ExecuteWithReplication>d__164`1.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Client.Lightweight\Connection\Async\AsyncServerClient.cs:line 0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Raven.Abstractions.Util.AsyncHelpers.<>c__DisplayClass1_1`1.<<RunSync>b__0>d.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Util\AsyncHelpers.cs:line 75 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Raven.Abstractions.Util.AsyncHelpers.RunSync[T](Func`1 task) in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Util\AsyncHelpers.cs:line 89 at Raven.Client.Connection.ServerClient.Query(String index, IndexQuery query, String[] includes, Boolean metadataOnly, Boolean indexEntriesOnly) in C:\Builds\RavenDB-3.5-Patch\Raven.Client.Lightweight\Connection\ServerClient.cs:line 288


Nick

unread,
Jun 22, 2017, 5:19:57 AM6/22/17
to RavenDB - 2nd generation document database
Build 35202 BTW

Tal Weiss

unread,
Jun 22, 2017, 9:23:15 AM6/22/17
to RavenDB - 2nd generation document database
Hi Nick,
The issue is resolved http://issues.hibernatingrhinos.com/issue/RavenDB-7564 we will have a new build created soon.
As a work around you will need to set Raven/Indexing/UseLuceneASTParser  to false.


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Tal Weiss l Core Team Developer Mobile:+972-54-802-4849

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811l Skype: talweiss1982

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/ 

Nick

unread,
Jun 23, 2017, 5:19:50 AM6/23/17
to RavenDB - 2nd generation document database
Thanks Tal - are there any side effects from applying that config setting?
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Oren Eini (Ayende Rahien)

unread,
Jun 23, 2017, 10:02:00 AM6/23/17
to ravendb
Queries will be slightly more expensive to parse

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages