Skip to content

Can't query Patient IDs with forward slash #1

@Enet4

Description

@Enet4

Originally from dicoogle/dicoogle#490:

When performing a C-FIND against Dicoogle v3.0.2 using a Patient ID with a forward slash (/) such as "25/1807" I get an error. Here is the output from the command window:

NEW Query: PatientID:25/1807
Charset: null
INFO  server.SearchDicomResult (SearchDicomResult.java:94) - QUERY: PatientID:25/1807
INFO  server.SearchDicomResult (SearchDicomResult.java:95) - QUERYLEVEL: STUDY
ERROR lucene.LuceneQuery (LuceneQuery.java:112) - Error parsing query
org.apache.lucene.queryparser.classic.ParseException: Cannot parse 'PatientID:25/1807': Lexical error at line 1, column 18.  Encountered: <EOF> after : "/1807"
        at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:116) ~[lucene-3.0.2.jar:?]
        at dicoogle.lucene.GenericQueryParser.parse(GenericQueryParser.java:71) ~[lucene-3.0.2.jar:?]
        at dicoogle.lucene.LuceneQuery.query(LuceneQuery.java:110) [lucene-3.0.2.jar:?]
        at pt.ua.dicoogle.plugins.PluginController$1.call(PluginController.java:606) [dicoogle.jar:3.0.2]
        at pt.ua.dicoogle.plugins.PluginController$1.call(PluginController.java:600) [dicoogle.jar:3.0.2]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_291]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_291]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_291]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_291]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_291]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]
Caused by: org.apache.lucene.queryparser.classic.TokenMgrError: Lexical error at line 1, column 18.  Encountered: <EOF> after : "/1807"
        at org.apache.lucene.queryparser.classic.QueryParserTokenManager.getNextToken(QueryParserTokenManager.java:1119) ~[?:?]
        at org.apache.lucene.queryparser.classic.QueryParser.jj_ntk(QueryParser.java:862) ~[?:?]
        at org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:429) ~[?:?]
        at org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:355) ~[?:?]
        at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:244) ~[?:?]
        at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:215) ~[?:?]
        at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:111) ~[?:?]
        ... 10 more

The issue still persists though in 3.4.1. After looking at the call stack, it seems the error is in the Lucene queryparser package and the Dicoogle Lucene plugin would have to escape the forward slash before calling parse. See here for issue: https://stackoverflow.com/questions/17798300/lucene-queryparser-with-in-query-criteria

And here in code for where it would get fixed: https://github.com/dicoogle/dicoogle-plugins/blob/main/plugins/lucene/src/main/java/dicoogle/lucene/GenericQueryParser.java#L69

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions