Query files using OnDirectory fails with exception

52 views
Skip to first unread message

marcus

unread,
Aug 31, 2014, 12:13:23 PM8/31/14
to rav...@googlegroups.com
I'm using RavenDB 3.0.3460-Unstable with this code

using (var session = _filesStore.OpenAsyncSession())
{
var files = await session.Query().OnDirectory("/images").ToListAsync();
};

this fails with this exception http://bit.ly/1qYFVID


Federico Lois

unread,
Aug 31, 2014, 2:13:10 PM8/31/14
to rav...@googlegroups.com


using (var session = _filesStore.OpenAsyncSession())
{
var files = await session.Query().OnDirectory("images").ToListAsync();
};
 


--
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

marcus

unread,
Aug 31, 2014, 2:51:05 PM8/31/14
to rav...@googlegroups.com
For me, it still throws an exception. The query looks like this /fs/BrickPile/search/?query=(__directory:/images%20AND%20-__directory:/images/*)%20AND&start=0&pageSize=1024 but if I alter the query to /fs/BrickPile/search/?query=(__directory:/images%20AND%20-__directory:/images/*) and put it into the browser it returns the correct data.

This is the actual error message when I try the query directly in the browser using the first query: /fs/BrickPile/search/?query=(__directory:/images%20AND%20-__directory:/images/*)%20AND&start=0&pageSize=1024

{
 
"Url": "/fs/BrickPile/search/?query=(__directory:/images%20AND%20-__directory:/images/*)%20AND&start=0&pageSize=1024",
 
"Error": "Lucene.Net.QueryParsers.ParseException: Cannot parse '(__directory:/images AND -__directory:/images/*) AND': Encountered \"<EOF>\" at line 1, column 52.\nWas expecting one of:\n    <NOT> ...\n    \"+\" ...\n    \"-\" ...\n    \"(\" ...\n    \"*\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <NUMBER> ...\n    <TERM> ...\n    \"*\" ...\n     ---> Lucene.Net.QueryParsers.ParseException: Encountered \"<EOF>\" at line 1, column 52.\nWas expecting one of:\n    <NOT> ...\n    \"+\" ...\n    \"-\" ...\n    \"(\" ...\n    \"*\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <NUMBER> ...\n    <TERM> ...\n    \"*\" ...\n    \r\n   at Lucene.Net.QueryParsers.QueryParser.Jj_consume_token(Int32 kind)\r\n   at Lucene.Net.QueryParsers.QueryParser.Clause(String field)\r\n   at Lucene.Net.QueryParsers.QueryParser.Query(String field)\r\n   at Lucene.Net.QueryParsers.QueryParser.Parse(String query)\r\n   --- End of inner exception stack trace ---\r\n   at Lucene.Net.QueryParsers.QueryParser.Parse(String query)\r\n   at Raven.Database.Server.RavenFS.Search.IndexStorage.Query(String query, String[] sortFields, Int32 start, Int32 pageSize, Int32& totalResults) in c:\\Builds\\RavenDB-3.0-PreRelease\\Raven.Database\\Server\\RavenFS\\Search\\IndexStorage.cs:line 63\r\n   at Raven.Database.Server.RavenFS.Controllers.SearchController.Get(String query, String[] sort) in c:\\Builds\\RavenDB-3.0-PreRelease\\Raven.Database\\Server\\RavenFS\\Controllers\\SearchController.cs:line 34\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()"
}

marcus

unread,
Sep 1, 2014, 11:23:21 AM9/1/14
to rav...@googlegroups.com
Can anyone verify if this works, because it doesn't for me?

Federico Lois

unread,
Sep 1, 2014, 12:13:50 PM9/1/14
to rav...@googlegroups.com
I hace already fixed it in my branch as soon as Oren merge it in the truck it will be available in the next unstable.

From: marcus
Sent: ‎01/‎09/‎2014 12:23 p.m.
To: rav...@googlegroups.com
Subject: Re: [RavenDB] Query files using OnDirectory fails with exception

Can anyone verify if this works, because it doesn't for me?

marcus

unread,
Sep 1, 2014, 12:21:17 PM9/1/14
to rav...@googlegroups.com
Ok, fantastic!

Federico Lois

unread,
Sep 2, 2014, 7:53:28 AM9/2/14
to rav...@googlegroups.com
Unstable Build #3465 already has the fix for OnDirectory. 

marcus

unread,
Sep 2, 2014, 6:33:32 PM9/2/14
to rav...@googlegroups.com
Nice, that solved the problem. Another thing, if I run session.Query().OnDirectory(folder).ToListAsync(); and folder is an empty string I get all files recursive even though recursive is false by default, is this correct?

Federico Lois

unread,
Sep 2, 2014, 8:24:20 PM9/2/14
to rav...@googlegroups.com
No. Is not correct. Should return only the root. Will fix that one tomorrow first time in the morning.

From: marcus
Sent: ‎02/‎09/‎2014 19:33

Federico Lois

unread,
Sep 3, 2014, 6:32:34 PM9/3/14
to rav...@googlegroups.com
Marcus,

I have been working on this: http://issues.hibernatingrhinos.com/issue/RavenDB-2673 but it is a bit more involved than expected. Will get you back as soon as I have a solution for it. 

Federico
Reply all
Reply to author
Forward
0 new messages