Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document setting up full text search #100

Open
Ninjaclasher opened this issue Nov 13, 2020 · 5 comments
Open

Document setting up full text search #100

Ninjaclasher opened this issue Nov 13, 2020 · 5 comments

Comments

@Ninjaclasher
Copy link
Member

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);
@JasonLovesDoggo
Copy link

Would a simple

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

Added to a new migration not just do the trick?

@quantum5
Copy link
Member

quantum5 commented Oct 1, 2024

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.

@JasonLovesDoggo
Copy link

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.

@quantum5
Copy link
Member

quantum5 commented Oct 1, 2024

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.

@JasonLovesDoggo
Copy link

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 added a commit to JasonLovesDoggo/online-judge that referenced this issue Oct 1, 2024
Adds a FULLTEXT index to the `Problem` model as needed by the builtin search. Includes migration and tests (skipped for non-MySQL databases).

see DMOJ/docs#100
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

No branches or pull requests

3 participants