Skip to content

Conversation

@indykoning
Copy link
Member

This pr adds the ability to override the relevanceQueryMatch by using it as the default value.
Also moved this functionality to the mixin, so it can be used for the autocomplete as well as the listings

Also removed the array return value by default, keeping it backwards compatible. However if you want to set multiple queries in your callback you should exlicitly define it's behaviour by wrapping it in e.g. bool.should:

    return {
        'bool': {
            'should': [
                {
                    'neural': {
                        'content_embedding': {
                            'query_text': query,
                            'model_id': '...',
                            'min_score': 1.0,
                        }
                    }
                },
                Vue.prototype.relevanceQueryMatch(query, searchAttributes, config?.fuzziness)
            ],
            "minimum_should_match": 1
        }
    }

As you might guess, this also prepares for neural searching

@indykoning indykoning requested review from Jade-GG and royduin October 15, 2025 09:24
Comment on lines +12 to +15
// __NO_QUERY__ is a temporary band-aid for https://github.com/searchkit/searchkit/pull/1407
if (query && query !== '__NO_QUERY__') {
return this.relevanceQueryMatch(query, searchAttributes, config?.fuzziness)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could still move this to the getQuery function, removing the ability to remove/move the relevanceQueryMatch which hasn't been an ability yet until now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't necessarily mind this approach, but now if you want to add an extra query to this (for example, some kind of extra scoring function) you will also need to re-define this functionality inside of the prop. Seems a bit unwieldy to me for those cases.

Might be better in practice to have a prop that lets you disable the default query?

getQuery(query, search_attributes, config) {
const esQuery = this.query(...arguments)
let queries = Array.isArray(esQuery) ? esQuery : [esQuery]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check just makes sure it's backwards compatible with the old way of returning an array of queries instead of a query on it's own

@royduin
Copy link
Member

royduin commented Oct 15, 2025

Seems like the category positions aren't working anymore

@indykoning
Copy link
Member Author

I have discarded the changes, it was a fix for an issue that only seems to occur locally

@royduin
Copy link
Member

royduin commented Oct 17, 2025

This also depends on searchkit/searchkit#1411 right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants