You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (JIRA)" <ji...@apache.org> on 2014/08/11 23:48:13 UTC

[jira] [Comment Edited] (CXF-5938) LuceneQueryVisitior is not reusable / not thread-safe

    [ https://issues.apache.org/jira/browse/CXF-5938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14093360#comment-14093360 ] 

Andriy Redko edited comment on CXF-5938 at 8/11/14 9:47 PM:
------------------------------------------------------------

*[Sergey Beryozkin]*

Yeah... hmm...thanks for spotting it. I guess we need to have a new 
method added to SearchConditionVisitor, reset(). IMHO 
SearchConditionVisitor#getQuery() should produce the same result if 
called multiple times, but reset() would ensure the state is cleared.

And on top of it it is not thread safe, ouch. We'd have to have a 
VisitorState<Stack<List<Query>>> added to LuceneQueryVisitor, have a 
look at SQLPrinterVisitor, it has a LocalVisitorState<StringBuilder> by 
default, so Lucene one would have LocalVisitorState<Stack<List<Query>>> 
by default too, a thread local visitor can be optionally injected too.


was (Author: reta):
[Sergey Beryozkin]

Yeah... hmm...thanks for spotting it. I guess we need to have a new 
method added to SearchConditionVisitor, reset(). IMHO 
SearchConditionVisitor#getQuery() should produce the same result if 
called multiple times, but reset() would ensure the state is cleared.

And on top of it it is not thread safe, ouch. We'd have to have a 
VisitorState<Stack<List<Query>>> added to LuceneQueryVisitor, have a 
look at SQLPrinterVisitor, it has a LocalVisitorState<StringBuilder> by 
default, so Lucene one would have LocalVisitorState<Stack<List<Query>>> 
by default too, a thread local visitor can be optionally injected too.

> LuceneQueryVisitior is not reusable / not thread-safe
> -----------------------------------------------------
>
>                 Key: CXF-5938
>                 URL: https://issues.apache.org/jira/browse/CXF-5938
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 3.0.1
>            Reporter: Andriy Redko
>            Assignee: Andriy Redko
>            Priority: Minor
>             Fix For: 3.0.2
>
>
> LuceneQueryVisitor class is not really reusable in current implementation: it keeps the state of all parsed queries (which is generally fine) but it groups them by property name, returning the first query from the list all the time. That means running two search criteria like 'ct=java' and 'ct=websockets' causes the result of 'ct=java' to be returned in both cases (very easy reproducible).



--
This message was sent by Atlassian JIRA
(v6.2#6252)