Random sort

  • kuro19
    Participant
    10 months, 3 weeks ago #37570

    Hi,

    There is random sort and it used to work on Apache solr. After switch to Elasticsearch it’s no longer working, I don’t see error message so no idea how to debug this!

    Can you please recheck?

    Thank you.

    wpsolr
    Keymaster
    10 months, 3 weeks 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

    kuro19
    Participant
    10 months, 3 weeks ago #37582

    Switched from Solr to Elasticsearch and the function just stop working so kind of unexpected! I’m looking forward to the update.

    Thank you.

    wpsolr
    Keymaster
    9 months ago #38492

    WPSOLR 23.6 is ready.

    kuro19
    Participant
    9 months ago #38507

    Hi,

    The random sort returns the same result as I tested on 23.6.

    wpsolr
    Keymaster
    9 months ago #38508

    Randomness is across sessions: different visitors will see different results. But a visitor will see the same results.

    Please try with a new session, like with another browser or in incognito mode.

    kuro19
    Participant
    7 months, 2 weeks ago #39935

    Hi,

    I tested in incognito mode and the result is the same. Seem results are cached and I have no idea how to control it.

    Can the random function actually be more random?

    Thank you.

    wpsolr
    Keymaster
    7 months, 2 weeks ago #39995

    You can activate the Query monitor add-on, and check if the Elasticsearch random query yields a different seed with different sessions.

    kuro19
    Participant
    7 months ago #40314

    Strangely, I cannot active the extension, it say “Feature-limited version, click to activate”!

    wpsolr
    Keymaster
    7 months ago #40333

    Please deactivate your license, and reactivate it.

    kuro19
    Participant
    7 months ago #40334

    But a visitor will see the same results.

    I just notice this in your previous reply! If so, it’s not really random anymore. Can the seed expire after a certain time so the sort will be random again?

    Thanks.

    wpsolr
    Keymaster
    7 months ago #40376

    We use the same randomness for Apache Solr and Elasticsearch, generated from wp_get_session_token().

    kuro19
    Participant
    6 months, 4 weeks ago #40446

    It would explain why the sort result is the same when I test, unless a user logout and login again! Would it be better to consider another option such as expired by time?

    Thanks.

    wpsolr
    Keymaster
    6 months, 4 weeks ago #40498

    We only provide this session-based random feature.

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.