I ended up using simple query parser which probably more fits my
requirements. I can use params:
q.operators="" and it ignores all lucene special functionalities and take
query phrase as it is. But i still think something is wrong with dismax, i
use JSON instead of url params so it should not cause a problem for any
special characters.

My final query is:
{
  limit : 10,
  params:{
      q.operators:"",
      defType:"simple",
      q:"${query}",
      q.op:"${operator}",
      qf:"${fields}",
      indent:"off"
  }
}

2017-01-29 13:19 GMT+01:00 Ahmet Arslan <iori...@yahoo.com.invalid>:

> Hi,
>
> I don't think dismax recognizes AND OR.
> Special characters for dismax are + - and quotes.
>
> In your example, ampersand may causing you trouble. Due to URL encode
> stuff...
> Ahmet
>
> On Sunday, January 29, 2017 12:17 AM, Jarosław Grązka <
> jaroslaw.gra...@gmail.com> wrote:
>
>
>
> Hi,
>
> Reading Solr documentation about dismax query
> https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser i
> understood dismax query parser can interpret following special chars:
> AND,OR,+,-,quotes (for phrases) and should ignore all others like
> ||,NOT,&&,~,^ etc and treat them as simple strings.
>
> But when i try query as follows:
> {
>   "limit" : 10,
>   params:{
>       defType:"dismax",
>       q:"Difference && Java",
>       q.op:"OR",
>       qf:"body",
>       indent: "on"
>   }
> }
> This && opeartors works as AND.
>
> I also got exceptions for this query:
> {
>   "limit" : 10,
>   params:{
>       defType:"dismax",
>       q:"Difference && Java NOT",
>       q.op:"OR",
>       qf:"body",
>       indent: "on"
>   }
> }
>
> Did i misunderstand something? Shouldnt it treat 'NOT' as just String?
>

Reply via email to