Magento 2.3.1模糊性不适用于查询字符串查询

时间:2019-06-13 06:41:17

标签: elasticsearch full-text-search query-string fuzzy-search magento-2.3

由于我想在Mirasvit Search扩展程序中自定义模糊搜索结果,因此我正在通过引用this使用查询字符串查询进行模糊查询文献。我可以打印由Magento构建的查询,如下所示:

Array
(
    [bool] => Array
        (
            [must] => Array
                (
                    [0] => Array
                        (
                            [terms] => Array
                                (
                                    [visibility_raw] => Array
                                        (
                                            [0] => 3
                                            [1] => 4
                                        )

                                )

                        )

                    [1] => Array
                        (
                            [query_string] => Array
                                (
                                    [fields] => Array
                                        (
                                            [0] => options
                                            [1] => sku
                                            [2] => name
                                            [3] => description
                                            [4] => short_description
                                            [5] => price
                                            [6] => manufacturer
                                            [7] => color
                                            [8] => status
                                            [9] => tax_class_id
                                            [10] => fashion_color
                                            [11] => fashion_material
                                            [12] => fashion_style
                                            [13] => has_video
                                        )

                                    [query] => (((quikc OR *quikc*)))
                                )

                        )

                )

            [should] => Array
                (
                    [0] => Array
                        (
                            [wildcard] => Array
                                (
                                    [sku] => Array
                                        (
                                            [value] => *quikc*
                                            [boost] => 64
                                        )

                                )

                        )

                    [1] => Array
                        (
                            [wildcard] => Array
                                (
                                    [name] => Array
                                        (
                                            [value] => *quikc*
                                            [boost] => 32
                                        )

                                )

                        )

                )

        )

)

如果在自动完成文本框中搜索字符串“ quick”,则可以在自动完成弹出窗口中获取结果。但是,如果我搜索“ quikc”,它将返回Sorry, nothing found for "quikc"。因此,根据this链接中给出的解决方案,我将[query] => (((quikc OR *quikc*)))更改为[query] => (((quikc~ OR *quikc*))),但仍然没有得到模糊的结果。

有人可以帮我解决这个问题吗?谢谢您。

0 个答案:

没有答案