Suppose I have a set of documents that look likes this:

[
    {
        "id": "1",
        "post_time": "2017-10-24T13:00:00Z",
        "category": "information technology",
        "url": "https://www.mywebsite.com";,
        "blog_post": "solr",
        "is_root_document": true,
        "_childDocuments_": [{
            "id": "comment-1",
            "title": "awesome work",
            "comment": "this was a great read",
            "is_root_document": false
        }]
    },
    {
        "id": "2",
        "post_time": "2017-10-24T13:00:00Z",
        "url": "https://www.mywebsite.com";,
        "category": "gardening",
        "is_root_document": true,
        "blog_post": "bob's garden",
        "_childDocuments_": [{
            "id": "comment-2",
            "title": "green everywhere",
            "comment": "where are the other colours?",
            "is_root_document": false
        }]
    }
]

Now suppose I post the following query to Solr:

select?q={!parent which=is_root_document:true}&fq=category:"information
technology"&fl=*,[child parentFilter=is_root_document:true]
I get the following (expected) response:

[
    {
        "id": "1",
        "post_time": "2017-10-24T13:00:00Z",
        "category": "information technology",
        "url": "https://www.mywebsite.com";,
        "blog_post": "solr",
        "is_root_document": true,
        "_childDocuments_": [{
            "id": "comment-1",
            "title": "awesome work",
            "comment": "this was a great read",
            "is_root_document": false
        }]
    }
]

Now suppose I append the following json.facet argument to the above query:

select?q={!parent which=is_root_document:true}&fq=category:"information
technology"&fl=*,[child
parentFilter=is_root_document:true]&json.facet={"comment_titles": {"type":
"terms", "field": "title", "domain": { "blockChildren":
"category:\"information technology\"" }}}

The facet response that is returned to me is:

"facets": {
        "count": 1,
        "comment_titles": {
            "buckets": [
                {
                    "val": "awesome work",
                    "count": 1
                },
                {
                    "val": "green everywhere",
                    "count": 1
                }
            ]
        }
    }

My question is: Why is Solr returning the "green everywhere" value, when
I’ve explicitly filtered it out from the document set with the
'fq=category:"information technology"' filter and domain statements? What
changes do I need to make to get my desired behaviour?



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to