Random sort
-
wpsolrKeymaster2 years, 10 months ago #37571
It could be due to https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-random:
It was possible to set a seed without setting a field, but this has been deprecated as this requires loading fielddata on the _id field which consumes a lot of memory.
It will be checked and eventually fixed on WPSOLR 23.6
wpsolrKeymaster2 years, 8 months ago #38492WPSOLR 23.6 is ready.
wpsolrKeymaster2 years, 7 months ago #39995You can activate the Query monitor add-on, and check if the Elasticsearch random query yields a different seed with different sessions.
kuro19Participant1 year, 7 months ago #53349Hi,
For this issue, is there a hooks and filters available to modify the Elasticsearch query, so that I can random generate the seed? Example:
add_filter('wpsolr_elasticsearch_query_args', 'add_random_seed_to_query'); function add_random_seed_to_query($query_args) { $random_seed = rand(); // Assuming 'functions' exists in your query, adjust the path as needed $query_args['body']['query']['function_score']['functions'][0]['random_score']['seed'] = $random_seed; return $query_args; }
You must be logged in to reply to this topic.