docs icon indicating copy to clipboard operation
docs copied to clipboard

Document setting up full text search

Open Ninjaclasher opened this issue 5 years ago • 5 comments

The database schema generated through the migrations do not support FTS. The indexes must be created manually:

ALTER TABLE judge_problem ADD FULLTEXT(code, name, description);

Ninjaclasher avatar Nov 13 '20 17:11 Ninjaclasher

Would a simple

migrations.RunSQL("ALTER TABLE judge_problem ADD FULLTEXT(code, name, description);")

Added to a new migration not just do the trick?

JasonLovesDoggo avatar Oct 01 '24 03:10 JasonLovesDoggo

Would a simple

migrations.RunSQL("ALTER TABLE judge_problem ADD FULLTEXT(code, name, description);")

Added to a new migration not just do the trick?

RIP anyone who uses SQLite for basic local development then.

quantum5 avatar Oct 01 '24 05:10 quantum5

Would a simple

migrations.RunSQL("ALTER TABLE judge_problem ADD FULLTEXT(code, name, description);")

Added to a new migration not just do the trick?

RIP anyone who uses SQLite for basic local development then.

Oop true, a RunPython which checks the database configuration and then runs the SQL using db.connection.... could be used instead then.

JasonLovesDoggo avatar Oct 01 '24 05:10 JasonLovesDoggo

Oop true, a RunPython which checks the database configuration and then runs the SQL using db.connection.... could be used instead then.

You should use the schema editor, but sure, PRs welcome.

quantum5 avatar Oct 01 '24 05:10 quantum5

Would a simple

migrations.RunSQL("ALTER TABLE judge_problem ADD FULLTEXT(code, name, description);")

Added to a new migration not just do the trick?

RIP anyone who uses SQLite for basic local development then.

This is already not possible due to https://github.com/DMOJ/online-judge/blob/27f5a0e2e308e73a9fb1bf4ac264c1cbc6d1677a/judge/migrations/0089_submission_to_contest.py#L19 running an INNER JOIN in a format which SQLITE does not accept.

JasonLovesDoggo avatar Oct 01 '24 06:10 JasonLovesDoggo