Closed (fixed)
Project:
Search API
Version:
8.x-1.x-dev
Component:
Database backend
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2024 at 21:52 UTC
Updated:
20 Jan 2025 at 11:19 UTC
Jump to comment: Most recent
Comments
Comment #2
tobias märz commentedComment #4
tobias märz commentedComment #6
drunken monkeyThanks for suggesting this improvement!
As the test fails show, though, your implementation is a bit rough. Instead of forcing a new property on the database query object we can just use its
addMetaData()method. I updated the MR accordingly, please test/review.I also added support for Postgres. SQLite, however, doesn’t seem to support random seeds (yet), see here.
Before I can merge this it still needs tests, though. Would you be able to add some to
\Drupal\Tests\search_api_db\Kernel\BackendTest::searchWithRandom()? (We’ll just have to make sure to skip them for SQLite.)Comment #7
tobias märz commentedI don't have much experience in the code of the SearchAPI module. I tried it, but couldn't find a way to add the metadata to the query. Can you implement the test?
Comment #8
tobias märz commentedThought a bit wrong, added test for random sort with seed.
Comment #9
drunken monkeyGreat job, thanks a lot!
Unfortunately it’s not that easy anymore to test against other databases (after the switch to GitLab CI) but tests against MySQL pass and any problems with Postgres or SQLite should be reported on the weekend when the scheduled pipelines run.
I just did a bit of code cleanup and will now merge.
Thanks again!
Comment #11
drunken monkey