forked from HumanSignal/label-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: DEV-2214: Use contain instead of icontain in annotation result (H…
…umanSignal#2308) * fix: Annotation result performance with contain * Back * Works! * Some * Try to fix completed at performance * Fix tests * Add merge migration
- Loading branch information
Showing
3 changed files
with
121 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
label_studio/tasks/migrations/0017_new_index_anno_result.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Generated by Django 3.1.13 on 2021-09-13 07:39 | ||
import logging | ||
|
||
from django.db import migrations | ||
from django.contrib.postgres.operations import TrigramExtension | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def forwards(apps, schema_editor): | ||
if not schema_editor.connection.vendor.startswith('postgres'): | ||
logger.info('Database vendor: {}'.format(schema_editor.connection.vendor)) | ||
logger.info('Skipping migration without attempting to CREATE INDEX') | ||
return | ||
|
||
schema_editor.execute( | ||
'create index concurrently tasks_annotations_result_idx2 ' | ||
'on task_completion using gin (cast(result as text) gin_trgm_ops);' | ||
) | ||
|
||
|
||
def backwards(apps, schema_editor): | ||
if not schema_editor.connection.vendor.startswith('postgres'): | ||
logger.info('Database vendor: {}'.format(schema_editor.connection.vendor)) | ||
logger.info('Skipping migration without attempting to DROP INDEX') | ||
return | ||
|
||
schema_editor.execute('drop index tasks_annotations_result_idx2;') | ||
|
||
|
||
class Migration(migrations.Migration): | ||
atomic = False | ||
|
||
dependencies = [('tasks', '0016_auto_20220414_1408')] | ||
|
||
operations = [ | ||
TrigramExtension(), | ||
migrations.RunPython(forwards, backwards), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Django 3.1.14 on 2022-05-12 20:38 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tasks', '0017_new_index_anno_result'), | ||
('tasks', '0018_manual_migrate_counters'), | ||
] | ||
|
||
operations = [ | ||
] |