A different result with filters

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

A different result with filters

Владислав Властовский
Hi, I use 7.5.0 Solr

Why do I get two different results for similar requests?

First req/res:
{
  "query": "*:*",
  "limit": 0,
  "filter": [
    "{!parent which=kind_s:edition}condition_s:0",
    "{!parent which=kind_s:edition}price_i:[* TO 750000]"
  ]
}

{
  "response": {
    "numFound": 453,
    "start": 0,
    "docs": []
  }
}

And second query:
{
  "query": "*:*",
  "limit": 0,
  "filter": [
    "{!parent which=kind_s:edition}condition_s:0 AND price_i:[* TO 750000]"
  ]
}

{
  "response": {
    "numFound": 452,
    "start": 0,
    "docs": []
  }
}
Reply | Threaded
Open this post in threaded view
|

Re: A different result with filters

Emir Arnautović
Hi,
The second query is equivalent to:
> {
>  "query": "*:*",
>  "limit": 0,
>  "filter": [
>    "{!parent which=kind_s:edition}condition_s:0",
>    "price_i:[* TO 750000]"
>  ]
> }


HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 26 Oct 2018, at 08:49, Владислав Властовский <[hidden email]> wrote:
>
> Hi, I use 7.5.0 Solr
>
> Why do I get two different results for similar requests?
>
> First req/res:
> {
>  "query": "*:*",
>  "limit": 0,
>  "filter": [
>    "{!parent which=kind_s:edition}condition_s:0",
>    "{!parent which=kind_s:edition}price_i:[* TO 750000]"
>  ]
> }
>
> {
>  "response": {
>    "numFound": 453,
>    "start": 0,
>    "docs": []
>  }
> }
>
> And second query:
> {
>  "query": "*:*",
>  "limit": 0,
>  "filter": [
>    "{!parent which=kind_s:edition}condition_s:0 AND price_i:[* TO 750000]"
>  ]
> }
>
> {
>  "response": {
>    "numFound": 452,
>    "start": 0,
>    "docs": []
>  }
> }

Reply | Threaded
Open this post in threaded view
|

Re: A different result with filters

Владислав Властовский
Emir, no

пт, 26 окт. 2018 г. в 10:17, Emir Arnautović <[hidden email]>:

> Hi,
> The second query is equivalent to:
> > {
> >  "query": "*:*",
> >  "limit": 0,
> >  "filter": [
> >    "{!parent which=kind_s:edition}condition_s:0",
> >    "price_i:[* TO 750000]"
> >  ]
> > }
>
>
> HTH,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>
>
>
> > On 26 Oct 2018, at 08:49, Владислав Властовский <[hidden email]> wrote:
> >
> > Hi, I use 7.5.0 Solr
> >
> > Why do I get two different results for similar requests?
> >
> > First req/res:
> > {
> >  "query": "*:*",
> >  "limit": 0,
> >  "filter": [
> >    "{!parent which=kind_s:edition}condition_s:0",
> >    "{!parent which=kind_s:edition}price_i:[* TO 750000]"
> >  ]
> > }
> >
> > {
> >  "response": {
> >    "numFound": 453,
> >    "start": 0,
> >    "docs": []
> >  }
> > }
> >
> > And second query:
> > {
> >  "query": "*:*",
> >  "limit": 0,
> >  "filter": [
> >    "{!parent which=kind_s:edition}condition_s:0 AND price_i:[* TO
> 750000]"
> >  ]
> > }
> >
> > {
> >  "response": {
> >    "numFound": 452,
> >    "start": 0,
> >    "docs": []
> >  }
> > }
>
>
Reply | Threaded
Open this post in threaded view
|

Re: A different result with filters

kydryavtsev andrey
In reply to this post by Владислав Властовский
This two queries are not similar.  If you have parent with two children - "{condition_s:0, price_i: 1000000}"  and "{condition_s:1, price_i: 10}", it will be matched by first query, it won't be matched by second.
   



26.10.2018, 09:50, "Владислав Властовский" <[hidden email]>:

> Hi, I use 7.5.0 Solr
>
> Why do I get two different results for similar requests?
>
> First req/res:
> {
>   "query": "*:*",
>   "limit": 0,
>   "filter": [
>     "{!parent which=kind_s:edition}condition_s:0",
>     "{!parent which=kind_s:edition}price_i:[* TO 750000]"
>   ]
> }
>
> {
>   "response": {
>     "numFound": 453,
>     "start": 0,
>     "docs": []
>   }
> }
>
> And second query:
> {
>   "query": "*:*",
>   "limit": 0,
>   "filter": [
>     "{!parent which=kind_s:edition}condition_s:0 AND price_i:[* TO 750000]"
>   ]
> }
>
> {
>   "response": {
>     "numFound": 452,
>     "start": 0,
>     "docs": []
>   }
> }
Reply | Threaded
Open this post in threaded view
|

Re: A different result with filters

Владислав Властовский
Andrey, ok

How can I tag the filter then?

I send:
{
  "query": "*:*",
  "limit": 1000,
  "filter": [
    "{!parent which=kind_s:edition}condition_s:0 AND {!tag=price}price_i:[*
TO 750000]"
  ]
}

I got:
{
  "error": {
    "metadata": [
      "error-class",
      "org.apache.solr.common.SolrException",
      "root-error-class",
      "org.apache.solr.parser.ParseException"
    ],
    "msg": "org.apache.solr.search.SyntaxError: Cannot parse 'price_i:[*':
Encountered \"<EOF>\" at line 1, column 10.\nWas expecting:\n    \"TO\"
...\n    ",
    "code": 400
  }
}

пт, 26 окт. 2018 г. в 16:23, Kydryavtsev Andrey <[hidden email]>:

> This two queries are not similar.  If you have parent with two children -
> "{condition_s:0, price_i: 1000000}"  and "{condition_s:1, price_i: 10}", it
> will be matched by first query, it won't be matched by second.
>
>
>
>
> 26.10.2018, 09:50, "Владислав Властовский" <[hidden email]>:
> > Hi, I use 7.5.0 Solr
> >
> > Why do I get two different results for similar requests?
> >
> > First req/res:
> > {
> >   "query": "*:*",
> >   "limit": 0,
> >   "filter": [
> >     "{!parent which=kind_s:edition}condition_s:0",
> >     "{!parent which=kind_s:edition}price_i:[* TO 750000]"
> >   ]
> > }
> >
> > {
> >   "response": {
> >     "numFound": 453,
> >     "start": 0,
> >     "docs": []
> >   }
> > }
> >
> > And second query:
> > {
> >   "query": "*:*",
> >   "limit": 0,
> >   "filter": [
> >     "{!parent which=kind_s:edition}condition_s:0 AND price_i:[* TO
> 750000]"
> >   ]
> > }
> >
> > {
> >   "response": {
> >     "numFound": 452,
> >     "start": 0,
> >     "docs": []
> >   }
> > }
>
Reply | Threaded
Open this post in threaded view
|

Re: A different result with filters

kydryavtsev andrey
There supposed to be support of children "filters" attribute in latest releases. Try it out.

 Link https://lucene.apache.org/solr/guide/7_3/other-parsers.html#filtering-and-tagging-2

26.10.2018, 16:34, "Владислав Властовский" <[hidden email]>:

> Andrey, ok
>
> How can I tag the filter then?
>
> I send:
> {
>   "query": "*:*",
>   "limit": 1000,
>   "filter": [
>     "{!parent which=kind_s:edition}condition_s:0 AND {!tag=price}price_i:[*
> TO 750000]"
>   ]
> }
>
> I got:
> {
>   "error": {
>     "metadata": [
>       "error-class",
>       "org.apache.solr.common.SolrException",
>       "root-error-class",
>       "org.apache.solr.parser.ParseException"
>     ],
>     "msg": "org.apache.solr.search.SyntaxError: Cannot parse 'price_i:[*':
> Encountered \"<EOF>\" at line 1, column 10.\nWas expecting:\n \"TO\"
> ...\n ",
>     "code": 400
>   }
> }
>
> пт, 26 окт. 2018 г. в 16:23, Kydryavtsev Andrey <[hidden email]>:
>
>>  This two queries are not similar. If you have parent with two children -
>>  "{condition_s:0, price_i: 1000000}" and "{condition_s:1, price_i: 10}", it
>>  will be matched by first query, it won't be matched by second.
>>
>>  26.10.2018, 09:50, "Владислав Властовский" <[hidden email]>:
>>  > Hi, I use 7.5.0 Solr
>>  >
>>  > Why do I get two different results for similar requests?
>>  >
>>  > First req/res:
>>  > {
>>  > "query": "*:*",
>>  > "limit": 0,
>>  > "filter": [
>>  > "{!parent which=kind_s:edition}condition_s:0",
>>  > "{!parent which=kind_s:edition}price_i:[* TO 750000]"
>>  > ]
>>  > }
>>  >
>>  > {
>>  > "response": {
>>  > "numFound": 453,
>>  > "start": 0,
>>  > "docs": []
>>  > }
>>  > }
>>  >
>>  > And second query:
>>  > {
>>  > "query": "*:*",
>>  > "limit": 0,
>>  > "filter": [
>>  > "{!parent which=kind_s:edition}condition_s:0 AND price_i:[* TO
>>  750000]"
>>  > ]
>>  > }
>>  >
>>  > {
>>  > "response": {
>>  > "numFound": 452,
>>  > "start": 0,
>>  > "docs": []
>>  > }
>>  > }
Reply | Threaded
Open this post in threaded view
|

Re: A different result with filters

Владислав Властовский
Andrey, thx. You are an expert!

пт, 26 окт. 2018 г. в 18:40, Kydryavtsev Andrey <[hidden email]>:

> There supposed to be support of children "filters" attribute in latest
> releases. Try it out.
>
>  Link
> https://lucene.apache.org/solr/guide/7_3/other-parsers.html#filtering-and-tagging-2
>
> 26.10.2018, 16:34, "Владислав Властовский" <[hidden email]>:
> > Andrey, ok
> >
> > How can I tag the filter then?
> >
> > I send:
> > {
> >   "query": "*:*",
> >   "limit": 1000,
> >   "filter": [
> >     "{!parent which=kind_s:edition}condition_s:0 AND
> {!tag=price}price_i:[*
> > TO 750000]"
> >   ]
> > }
> >
> > I got:
> > {
> >   "error": {
> >     "metadata": [
> >       "error-class",
> >       "org.apache.solr.common.SolrException",
> >       "root-error-class",
> >       "org.apache.solr.parser.ParseException"
> >     ],
> >     "msg": "org.apache.solr.search.SyntaxError: Cannot parse
> 'price_i:[*':
> > Encountered \"<EOF>\" at line 1, column 10.\nWas expecting:\n \"TO\"
> > ...\n ",
> >     "code": 400
> >   }
> > }
> >
> > пт, 26 окт. 2018 г. в 16:23, Kydryavtsev Andrey <[hidden email]>:
> >
> >>  This two queries are not similar. If you have parent with two children
> -
> >>  "{condition_s:0, price_i: 1000000}" and "{condition_s:1, price_i:
> 10}", it
> >>  will be matched by first query, it won't be matched by second.
> >>
> >>  26.10.2018, 09:50, "Владислав Властовский" <[hidden email]>:
> >>  > Hi, I use 7.5.0 Solr
> >>  >
> >>  > Why do I get two different results for similar requests?
> >>  >
> >>  > First req/res:
> >>  > {
> >>  > "query": "*:*",
> >>  > "limit": 0,
> >>  > "filter": [
> >>  > "{!parent which=kind_s:edition}condition_s:0",
> >>  > "{!parent which=kind_s:edition}price_i:[* TO 750000]"
> >>  > ]
> >>  > }
> >>  >
> >>  > {
> >>  > "response": {
> >>  > "numFound": 453,
> >>  > "start": 0,
> >>  > "docs": []
> >>  > }
> >>  > }
> >>  >
> >>  > And second query:
> >>  > {
> >>  > "query": "*:*",
> >>  > "limit": 0,
> >>  > "filter": [
> >>  > "{!parent which=kind_s:edition}condition_s:0 AND price_i:[* TO
> >>  750000]"
> >>  > ]
> >>  > }
> >>  >
> >>  > {
> >>  > "response": {
> >>  > "numFound": 452,
> >>  > "start": 0,
> >>  > "docs": []
> >>  > }
> >>  > }
>