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

Dr Oleg Savrasov commented on SOLR-9685:
----------------------------------------

[~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 me 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.

> 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

Reply via email to