You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jarosław Grązka <ja...@gmail.com> on 2017/01/28 21:17:25 UTC
Dismax query special characters
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?
Re: Dismax query special characters
Posted by Jarosław Grązka <ja...@gmail.com>.
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 <io...@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.grazka@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?
>
Re: Dismax query special characters
Posted by Ahmet Arslan <io...@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 <ja...@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?