SemanticMediaWiki / SemanticMediaWiki

🔗 Semantic MediaWiki turns MediaWiki into a knowledge management platform with query and export capabilities
https://www.semantic-mediawiki.org
Other
511 stars 227 forks source link

Not equal operator not working anymore on SMW 4.1.3 (ElasticStore) ? #5618

Open bertrandgorge opened 5 months ago

bertrandgorge commented 5 months ago

Setup

https://wiki.tripleperformance.fr/wiki/Sp%C3%A9cial:Version

Issue

The not equal operator does not seem to work anymore...!

This search string does not return anything: [[A la une::True]][[A un type de page::!Fiche technique]] when [[A la une::True]] clearly has several results with different A un type de page....

All results with different types ([[A la une::True]]): https://wiki.tripleperformance.fr/index.php?title=Sp%C3%A9cial:Ask&x=-5B-5BA-20la-20une%3A%3Avrai-5D-5D%2F-3FA-20un-20type-20de-20page&format=broadtable&limit=50&link=all&headers=show&searchlabel=...%20autres%20r%C3%A9sultats&class=sortable%20wikitable%20smwtable&prefix=none&sort=&order=asc&offset=0&mainlabel=

When using the debug query button, I get this:

{
    "smw": {
        "query": "[[A la une::True]][[A un type de page::!Fiche technique]]",
        "sort": {
            "": "ASC"
        },
        "metrics": {
            "query size": 4,
            "query depth": 1
        },
        "description_log": [
            {
                "Conjunction": "[[A la une::vrai]] [[A un type de page::!Fiche technique]]"
            },
            [
                {
                    "SomeProperty": "[[A la une::vrai]]"
                }
            ],
            [
                [
                    {
                        "SomeProperty": "[[A un type de page::!Fiche technique]]"
                    }
                ]
            ]
        ]
    },
    "elastic": [
        {
            "index": "smw-data-wiki_prod",
            "body": {
                "_source": false,
                "from": 0,
                "size": 51,
                "query": {
                    "constant_score": {
                        "filter": {
                            "bool": {
                                "must": [
                                    {
                                        "bool": {
                                            "filter": {
                                                "term": {
                                                    "P:37056.booField": true
                                                }
                                            }
                                        }
                                    },
                                    [
                                        {
                                            "exists": {
                                                "field": "P:27055.txtField"
                                            }
                                        },
                                        {
                                            "bool": {
                                                "must_not": {
                                                    "term": {
                                                        "P:27055.txtField.keyword": "Fiche technique"
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                ]
                            }
                        }
                    }
                },
                "sort": [
                    {
                        "subject.sortkey.sort": {
                            "order": "asc"
                        },
                        "subject.title.sort": {
                            "order": "asc"
                        }
                    }
                ]
            }
        },
        {
            "valid": false,
            "error": "ParsingException[Failed to parse]; nested: XContentParseException[[1:110] [bool] failed to parse field [must]]; nested: IllegalStateException[expected value but got [START_ARRAY]];; org.elasticsearch.common.xcontent.XContentParseException: [1:110] [bool] failed to parse field [must]"
        }
    ]
}
krabina commented 5 months ago

@marijnvanwezel can you confirm this?

marijnvanwezel commented 5 months ago

We have not come across this, but it may be similar to #5544.

bertrandgorge commented 5 months ago

The double array for the SomeProperty attribute in the description log seems suspicious to me, or is it not?

When I do the same query, but with [[A la une::vrai]] [[A un type de page::Fiche technique]] I get (where there's no such double array):

{
    "smw": {
        "query": "[[A la une::vrai]] [[A un type de page::Fiche technique]]",
        "sort": {
            "": "ASC"
        },
        "metrics": {
            "query size": 4,
            "query depth": 1
        },
        "description_log": [
            {
                "Conjunction": "[[A la une::vrai]] [[A un type de page::Fiche technique]]"
            },
            [
                {
                    "SomeProperty": "[[A la une::vrai]]"
                }
            ],
            [
                {
                    "SomeProperty": "[[A un type de page::Fiche technique]]"
                }
            ]
        ]
    },
    "elastic": [
        {
            "index": "smw-data-wiki_prod",
            "body": {
                "_source": false,
                "from": 0,
                "size": 51,
                "query": {
                    "constant_score": {
                        "filter": {
                            "bool": {
                                "must": [
                                    {
                                        "bool": {
                                            "filter": {
                                                "term": {
                                                    "P:37056.booField": true
                                                }
                                            }
                                        }
                                    },
                                    {
                                        "bool": {
                                            "filter": {
                                                "term": {
                                                    "P:27055.txtField.keyword": "Fiche technique"
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "sort": [
                    {
                        "subject.sortkey.sort": {
                            "order": "asc"
                        },
                        "subject.title.sort": {
                            "order": "asc"
                        }
                    }
                ]
            }
        },
        {
            "_shards": {
                "total": 1,
                "successful": 1,
                "failed": 0
            },
            "valid": true,
            "explanations": [
                {
                    "index": "smw-data-wiki_prod-v2",
                    "valid": true,
                    "explanation": "ConstantScore(+(#P:37056.booField:T) +(#P:27055.txtField.keyword:Fiche technique))"
                }
            ]
        }
    ]
}
bertrandgorge commented 2 months ago

I confirm that this is fixed by @marijnvanwezel 's patch: https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/5652