docspell icon indicating copy to clipboard operation
docspell copied to clipboard

Periodic Queries: doesn't like full text search

Open TheFehr opened this issue 10 months ago • 4 comments

I added a full text search as the query for a periodic query but now the list will no longer load due to a 500 internal error.

2025.03.03 13:10:20:0002 [io-comp...] [ERROR] docspell.restserver.RestServer.httpApp:133 - Processing the request resulted in an error.
java.lang.RuntimeException: Failed to read input near 13:
(& content:""Date";"Amount";"Original amount";"Original currency";"Exchange rate";"Description";"Subject";"Category";"Tags";"Wise";"Spaces"" )
Details: Expected: )                                                                              at scala.sys.package$.error(package.scala:27)        at docspell.query.ItemQueryParser$.$anonfun$parseUnsafe$1(ItemQueryParser.scala:42)
        at scala.util.Either.fold(Either.scala:198)                                               at docspell.query.ItemQueryParser$.parseUnsafe(ItemQueryParser.scala:42)                  at docspell.restserver.routes.PeriodicQueryRoutes$.$anonfun$taskToSettings$3(PeriodicQueryRoutes.scala:169)                                                                         at scala.Option.map(Option.scala:242)                                                     at docspell.restserver.routes.PeriodicQueryRoutes$.taskToSettings(PeriodicQueryRoutes.scala:169)                                                                                    at docspell.restserver.routes.PeriodicQueryRoutes$$anonfun$apply$1.$anonfun$applyOrElse$1(PeriodicQueryRoutes.scala:44)                                                             at fs2.Stream.evalOut$1(Stream.scala:1038)
        at fs2.Stream.$anonfun$evalMap$2(Stream.scala:1039)                                       at fs2.Pull$FlatMapR$1.loop$1(Pull.scala:1053)
        at fs2.Pull$FlatMapR$1.go$2(Pull.scala:1060)                                              at fs2.Pull$FlatMapR$1.unconsed(Pull.scala:1070)
        at fs2.Pull$FlatMapR$1.out(Pull.scala:1079)                                               at fs2.Pull$.$anonfun$compile$24(Pull.scala:1237)
        at fs2.Pull$.$anonfun$compile$2(Pull.scala:953)                                           at get @ fs2.internal.Scope.openScope(Scope.scala:275)
        at get @ fs2.internal.Scope.openScope(Scope.scala:275)                                    at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
        at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)                              at flatMap @ fs2.Pull$.fs2$Pull$$interruptGuard$1(Pull.scala:952)
        at map @ fs2.internal.InterruptContext.$anonfun$eval$5(InterruptContext.scala:96)         at main$ @ docspell.restserver.Main$.main(Main.scala:14)
        at as @ docspell.restserver.RestServer$.$anonfun$serve$4(RestServer.scala:75)     
2025.03.03 13:10:20:0003 [io-comp...] [INFO ] org.http4s.server.middleware.Logger - HTTP/1.1 GET /api/v1/sec/usertask/periodicquery

TheFehr avatar Mar 03 '25 12:03 TheFehr

Hi @TheFehr, it looks like the query is wrong. Of course, this shouldn't get stored in the first place 🙈 I suspect it is because of the double quotes and ;. Having quotes in quotes you need to use a \ inside a single quote. Can you try to fix it in the DB as a short term fix?

eikek avatar Mar 04 '25 07:03 eikek

Yeah I set the query to a valid empty one via the db and then just used a bookmark instead.

The query works with a bookmark 😅 (& content:"\"Date\";\"Amount\";\"Original amount\";\"Original currency\";\"Exchange rate\";\"Description\";\"Subject\";\"Category\";\"Tags\";\"Wise\";\"Spaces\"" )

TheFehr avatar Mar 04 '25 07:03 TheFehr

Ah ok, so you mean that the exact same query doesn't work when configured with a periodic query but does work for a bookmark?

eikek avatar Mar 05 '25 10:03 eikek

Yes, I worked the query out in search, then added it to a periodic which caused the crash. Adding it to a bookmark works just like using it directly in search.

TheFehr avatar Mar 06 '25 09:03 TheFehr