|
| 1 | +# Generated by Django 4.2.3 on 2025-11-26 21:02 |
| 2 | + |
| 3 | +from django.conf import settings |
| 4 | +from django.db import migrations, models |
| 5 | +import django.db.models.deletion |
| 6 | +import uuid |
| 7 | + |
| 8 | + |
| 9 | +class Migration(migrations.Migration): |
| 10 | + |
| 11 | + dependencies = [ |
| 12 | + ('api', '0014_alter_medrule_rule_type'), |
| 13 | + ] |
| 14 | + |
| 15 | + operations = [ |
| 16 | + migrations.CreateModel( |
| 17 | + name='SemanticSearchUsage', |
| 18 | + fields=[ |
| 19 | + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 20 | + ('guid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)), |
| 21 | + ('timestamp', models.DateTimeField(auto_now_add=True)), |
| 22 | + ('query_text', models.TextField(blank=True, help_text='The search query text', null=True)), |
| 23 | + ('document_name', models.TextField(blank=True, help_text='Document name filter if used', null=True)), |
| 24 | + ('document_guid', models.UUIDField(blank=True, help_text='Document GUID filter if used', null=True)), |
| 25 | + ('num_results_requested', models.IntegerField(default=10, help_text='Number of results requested')), |
| 26 | + ('encoding_time', models.FloatField(help_text='Time to encode query in seconds')), |
| 27 | + ('db_query_time', models.FloatField(help_text='Time for database query in seconds')), |
| 28 | + ('num_results_returned', models.IntegerField(help_text='Number of results returned')), |
| 29 | + ('min_distance', models.FloatField(blank=True, help_text='Minimum L2 distance (null if no results)', null=True)), |
| 30 | + ('max_distance', models.FloatField(blank=True, help_text='Maximum L2 distance (null if no results)', null=True)), |
| 31 | + ('median_distance', models.FloatField(blank=True, help_text='Median L2 distance (null if no results)', null=True)), |
| 32 | + ('user', models.ForeignKey(blank=True, help_text='User who performed the search (null for unauthenticated users)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='semantic_searches', to=settings.AUTH_USER_MODEL)), |
| 33 | + ], |
| 34 | + options={ |
| 35 | + 'ordering': ['-timestamp'], |
| 36 | + 'indexes': [models.Index(fields=['-timestamp'], name='api_semanti_timesta_0b5730_idx'), models.Index(fields=['user', '-timestamp'], name='api_semanti_user_id_e11ecb_idx')], |
| 37 | + }, |
| 38 | + ), |
| 39 | + ] |
0 commit comments