Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synonyms are added without considering boosting #929

Open
ComLock opened this issue Apr 4, 2024 · 1 comment
Open

Synonyms are added without considering boosting #929

ComLock opened this issue Apr 4, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@ComLock
Copy link
Member

ComLock commented Apr 4, 2024

I added a two way synonym between "hus" <-> "bolig"
Below I'm searching for "bolig" and "hus" is added, (without boost):

"query": {
        "boolean": {
            "should": [
                {
                    "fulltext": {
                        "fields": [
                            "_alltext"
                        ],
                        "query": "bolig",
                        "operator": "AND"
                    }
                },
                {
                    "stemmed": {
                        "fields": [
                            "_alltext"
                        ],
                        "query": "bolig",
                        "operator": "AND",
                        "language": "no",
                        "boost": 0.9
                    }
                },
                {
                    "ngram": {
                        "fields": [
                            "_alltext"
                        ],
                        "query": "bolig",
                        "operator": "AND",
                        "boost": 0.8
                    }
                },
                {
                    "term": {
                        "field": "displayname",
                        "value": "kurskalender",
                        "boost": 1
                    }
                },
                {
                    "fulltext": {
                        "fields": [
                            "_alltext"
                        ],
                        "operator": "AND",
                        "query": "hus"
                    }
                },
                {
                    "stemmed": {
                        "fields": [
                            "_alltext"
                        ],
                        "operator": "AND",
                        "query": "hus",
                        "language": "no"
                    }
                }
            ]
        }
    }
    ```
@ComLock ComLock added the Bug Something isn't working label Apr 4, 2024
@ComLock
Copy link
Member Author

ComLock commented Apr 4, 2024

Same in the more complex query with field boosting:

"query": {
        "boolean": {
            "should": [
                {
                    "boolean": {
                        "should": [
                            {
                                "fulltext": {
                                    "fields": [
                                        "displayname"
                                    ],
                                    "query": "bolig",
                                    "operator": "AND",
                                    "boost": 1.2
                                }
                            },
                            {
                                "fulltext": {
                                    "fields": [
                                        "_alltext"
                                    ],
                                    "query": "bolig",
                                    "operator": "AND"
                                }
                            }
                        ]
                    }
                },
                {
                    "boolean": {
                        "should": [
                            {
                                "stemmed": {
                                    "fields": [
                                        "displayname"
                                    ],
                                    "query": "bolig",
                                    "operator": "AND",
                                    "language": "no",
                                    "boost": 1.08
                                }
                            },
                            {
                                "stemmed": {
                                    "fields": [
                                        "_alltext"
                                    ],
                                    "query": "bolig",
                                    "operator": "AND",
                                    "language": "no",
                                    "boost": 0.9
                                }
                            }
                        ]
                    }
                },
                {
                    "boolean": {
                        "should": [
                            {
                                "ngram": {
                                    "fields": [
                                        "displayname"
                                    ],
                                    "query": "bolig",
                                    "operator": "AND",
                                    "boost": 0.96
                                }
                            },
                            {
                                "ngram": {
                                    "fields": [
                                        "_alltext"
                                    ],
                                    "query": "bolig",
                                    "operator": "AND",
                                    "boost": 0.8
                                }
                            }
                        ]
                    }
                },
                {
                    "term": {
                        "field": "displayname",
                        "value": "kurskalender",
                        "boost": 1.1
                    }
                },
                {
                    "fulltext": {
                        "fields": [
                            "displayname"
                        ],
                        "operator": "AND",
                        "query": "hus"
                    }
                },
                {
                    "stemmed": {
                        "fields": [
                            "displayname"
                        ],
                        "operator": "AND",
                        "query": "hus",
                        "language": "no"
                    }
                }
            ]
        }
    }

@ComLock ComLock self-assigned this Apr 5, 2024
@ComLock ComLock removed their assignment Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant