[jira] [Comment Edited] (SOLR-9685) tag a query in JSON syntax
[ https://issues.apache.org/jira/browse/SOLR-9685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16508720#comment-16508720 ] Dr Oleg Savrasov edited comment on SOLR-9685 at 6/11/18 8:56 PM: - [~mkhludnev], sorry for invalid JSON, my fault. An attempt to make it valid didn't help as well {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ query : "{!parent tag=top filters=$child.fq which=scope:product v=$childquery}", filter : "{!tag=top}category:clothes", params:{ childquery : "scope:sku", child.fq : { "#color" : "color:black" } } }'{code} I've tried to rework the request according to JSON DSL and just want to share my results, because I'm not sure if they are supposed to work or not. This one works fine {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ "query" : { "parent": { "query": "scope:sku", "filters" : [ "{!tag=color}color:black", "{!tag=size}size:L" ], "which": "scope:product" } } }' {code} while this {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ "query" : { "parent": { "query": "scope:sku", "filters" : [ { "#color" : "color:black" }, { "#size" : "size:L" } ], "which": "scope:product" } } }'{code} responds with {code:java} "error":{ "metadata":[ "error-class","org.apache.solr.common.SolrException", "root-error-class","org.apache.solr.search.SyntaxError"], "msg":"org.apache.solr.search.SyntaxError: Missing end to unquoted value starting at 6 str='{!tag=color'", "code":400}}{code} Absolutely the same results I've got with {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ "query" : { "parent": { "which": "scope:product", "query": { "bool": { "must":"scope:sku", "filter":[ "{!tag=color}color:black", "{!tag=size}size:L" ] } } } } }'{code} and {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ "query" : { "parent": { "which": "scope:product", "query": { "bool": { "must":"scope:sku", "filter":[ { "#color" : "color:black" }, { "#size" : "size:L" } ] } } } } }'{code} Finally [~mkhludnev]'s helped to find a working version, which doesn't look obvious for me. {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ "query" : { "parent": { "which": "scope:product", "query": { "bool": { "must":"scope:sku", "filter":[ { "#color" : {lucene: { "query":"color:black"} }}, { "#size" : {lucene: { "query":"size:L"} }} ] } } } } }'{code} Let me express my huge thanks to [~mkhludnev] for his incredible creativity and support. was (Author: osavrasov): [~mkhludnev], sorry for invalid JSON, my fault. An attempt to make it valid didn't help as well {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ query : "{!parent tag=top filters=$child.fq which=scope:product v=$childquery}", filter : "{!tag=top}category:clothes", params:{ childquery : "scope:sku", child.fq : { "#color" : "color:black" } } }'{code} I've tried to rework the request according to JSON DSL and just want to share my results, because I'm not sure if they are supposed to work or not. This one works fine {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ "query" : { "parent": { "query": "scope:sku", "filters" : [ "{!tag=color}color:black", "{!tag=size}size:L" ], "which": "scope:product" } } }' {code} while this {code:java} curl http://localhost:8983/solr/collection1/query -d 'json={ "query" : { "parent": { "query": "scope:sku", "filters" : [ { "#color" : "color:black" }, { "#size" : "size:L" } ], "which": "scope:product" } } }'{code} responds with
[jira] [Comment Edited] (SOLR-9685) tag a query in JSON syntax
[ https://issues.apache.org/jira/browse/SOLR-9685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16508417#comment-16508417 ] Mikhail Khludnev edited comment on SOLR-9685 at 6/11/18 6:35 PM: - [~osavrasov], beside of incorrect json, it seems like JSON DSL makes {{filters}} a little bit redundant. It's worth to try to write {{parent}} in JSON query DSL and use [bool|https://lucene.apache.org/solr/guide/7_3/json-query-dsl.html#compound-queries] as a child query with tagged filter clauses. was (Author: mkhludnev): [~osavrasov], beside of incorrect json, it seems like JSON DSL makes {{filters}} a little bit redundant. It's worth to try to write {{parent}} in JSON query DSL and use [https://lucene.apache.org/solr/guide/7_3/json-query-dsl.html#compound-queries|bool] as a child query with tagged filter clauses. > tag a query in JSON syntax > -- > > Key: SOLR-9685 > URL: https://issues.apache.org/jira/browse/SOLR-9685 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Components: Facet Module, JSON Request API >Reporter: Yonik Seeley >Assignee: Yonik Seeley >Priority: Major > Fix For: 7.4, master (8.0) > > Attachments: SOLR-9685.patch, SOLR-9685.patch > > Time Spent: 1.5h > Remaining Estimate: 0h > > There should be a way to tag a query/filter in JSON syntax. > Perhaps these two forms could be equivalent: > {code} > "{!tag=COLOR}color:blue" > { tagged : { COLOR : "color:blue" } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Comment Edited] (SOLR-9685) tag a query in JSON syntax
[ https://issues.apache.org/jira/browse/SOLR-9685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16479895#comment-16479895 ] Yonik Seeley edited comment on SOLR-9685 at 5/17/18 11:47 PM: -- Thanks Mikhail, I like the syntax! bq. omitting leading # is illegal and causes exception Not really... valid queries are also of the form { "query_type" : "query_val }, so the "#" disambiguates between a query type and a tag. For example, "join" would cause a join query to be parsed, while "#join" would mean a tag. bq. Leading # is kept in the tag name. That will cause confusion for people switching between multiple styles of tagging. We already have established uses of tags without hashes in them: {code} fq={!tag=color}item_color:blue {code} Also, we already have a way to add multiple tags via comma separation: {code} fq={!tag=color,item_description}item_color:blue {code} So the JSON equivalent should be: {code} { "#color,item_description" : "item_color:blue" } {code} was (Author: ysee...@gmail.com): Thanks Mikhail, I like the syntax! .bq omitting leading # is illegal and causes exception Not really... valid queries are also of the form { "query_type" : "query_val }, so the "#" disambiguates between a query type and a tag. For example, "join" would cause a join query to be parsed, while "#join" would mean a tag. .bq Leading # is kept in the tag name. That will cause confusion for people switching between multiple styles of tagging. We already have established uses of tags without hashes in them: {code} fq={!tag=color}item_color:blue {code} Also, we already have a way to add multiple tags via comma separation: {code} fq={!tag=color,item_description}item_color:blue {code} So the JSON equivalent should be: {code} { "#color,item_description" : "item_color:blue" } {code} > tag a query in JSON syntax > -- > > Key: SOLR-9685 > URL: https://issues.apache.org/jira/browse/SOLR-9685 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Components: Facet Module, JSON Request API >Reporter: Yonik Seeley >Priority: Major > Time Spent: 1.5h > Remaining Estimate: 0h > > There should be a way to tag a query/filter in JSON syntax. > Perhaps these two forms could be equivalent: > {code} > "{!tag=COLOR}color:blue" > { tagged : { COLOR : "color:blue" } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Comment Edited] (SOLR-9685) tag a query in JSON syntax
[ https://issues.apache.org/jira/browse/SOLR-9685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429838#comment-16429838 ] Mikhail Khludnev edited comment on SOLR-9685 at 5/10/18 8:47 PM: - [~squallsama], I'm afraid the proposed syntax is a way verbose. I propose to think about particular usage. [Here|https://lucene.apache.org/solr/guide/7_1/json-query-dsl.html#use-json-query-dsl-in-json-request-api] we have {code} { "query": { "bool": { "must_not": "{!frange u:3.0}ranking" } }, "filter: [ "title:solr", { "lucene" : {"df: "content", query : "lucene solr" }} ] } {code} I'd like to tag it like this {code} { // too hairish snippet } {code} Opinions? *UPD* repeating {{tag}} is boring, let's shorten it to the single hash like this {code} { "query": { "#top":{ "bool": { "must_not": "{!frange u:3.0}ranking" } } }, "filter: [ {"#title":"title:solr"}, { "#content": {"lucene" : {"df: "content", query : "lucene solr" }}} ] } {code} was (Author: mkhludnev): [~squallsama], I'm afraid the proposed syntax is a way verbose. I propose to think about particular usage. [Here|https://lucene.apache.org/solr/guide/7_1/json-query-dsl.html#use-json-query-dsl-in-json-request-api] we have {code} { "query": { "bool": { "must_not": "{!frange u:3.0}ranking" } }, "filter: [ "title:solr", { "lucene" : {"df: "content", query : "lucene solr" }} ] } {code} I'd like to tag it like this {code} { "query": { "bool": { "must_not": "{!frange u:3.0}ranking" }, "tag":"top" }, "filter: [ {"query":"title:solr", // the most tricky one "tag":"title" }, { "lucene" : {"df: "content", query : "lucene solr" }, "tag":"content" } ] } {code} Opinions? *UPD* repeating {{tag}} is boring, let's shorten it to the single hash like this {code} { "query": { "#top":{ "bool": { "must_not": "{!frange u:3.0}ranking" } } }, "filter: [ {"#title":"title:solr"}, { "#content": {"lucene" : {"df: "content", query : "lucene solr" }}} ] } {code} > tag a query in JSON syntax > -- > > Key: SOLR-9685 > URL: https://issues.apache.org/jira/browse/SOLR-9685 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Components: Facet Module, JSON Request API >Reporter: Yonik Seeley >Priority: Major > Time Spent: 1.5h > Remaining Estimate: 0h > > There should be a way to tag a query/filter in JSON syntax. > Perhaps these two forms could be equivalent: > {code} > "{!tag=COLOR}color:blue" > { tagged : { COLOR : "color:blue" } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Comment Edited] (SOLR-9685) tag a query in JSON syntax
[ https://issues.apache.org/jira/browse/SOLR-9685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429838#comment-16429838 ] Mikhail Khludnev edited comment on SOLR-9685 at 5/1/18 2:52 PM: [~squallsama], I'm afraid the proposed syntax is a way verbose. I propose to think about particular usage. [Here|https://lucene.apache.org/solr/guide/7_1/json-query-dsl.html#use-json-query-dsl-in-json-request-api] we have {code} { "query": { "bool": { "must_not": "{!frange u:3.0}ranking" } }, "filter: [ "title:solr", { "lucene" : {"df: "content", query : "lucene solr" }} ] } {code} I'd like to tag it like this {code} { "query": { "bool": { "must_not": "{!frange u:3.0}ranking" }, "tag":"top" }, "filter: [ {"query":"title:solr", // the most tricky one "tag":"title" }, { "lucene" : {"df: "content", query : "lucene solr" }, "tag":"content" } ] } {code} Opinions? *UPD* repeating {{tag}} is boring, let's shorten it to the single hash like this {code} { "query": { "#top":{ "bool": { "must_not": "{!frange u:3.0}ranking" } } }, "filter: [ {"#title":"title:solr"}, { "#content": {"lucene" : {"df: "content", query : "lucene solr" }}} ] } {code} was (Author: mkhludnev): [~squallsama], I'm afraid the proposed syntax is a way verbose. I propose to think about particular usage. [Here|https://lucene.apache.org/solr/guide/7_1/json-query-dsl.html#use-json-query-dsl-in-json-request-api] we have {code} { "query": { "bool": { "must_not": "{!frange u:3.0}ranking" } }, "filter: [ "title:solr", { "lucene" : {"df: "content", query : "lucene solr" }} ] } {code} I'd like to tag it like this {code} { "query": { "bool": { "must_not": "{!frange u:3.0}ranking" }, "tag":"top" }, "filter: [ {"query":"title:solr", // the most tricky one "tag":"title" }, { "lucene" : {"df: "content", query : "lucene solr" }, "tag":"content" } ] } {code} Opinions? > tag a query in JSON syntax > -- > > Key: SOLR-9685 > URL: https://issues.apache.org/jira/browse/SOLR-9685 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Components: Facet Module, JSON Request API >Reporter: Yonik Seeley >Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > There should be a way to tag a query/filter in JSON syntax. > Perhaps these two forms could be equivalent: > {code} > "{!tag=COLOR}color:blue" > { tagged : { COLOR : "color:blue" } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org