Full text search for repository name and description
Adds support for searching full text against the name and description of a repository [Delivers #134867401]
This commit is contained in:
parent
d65d32b284
commit
973a110ac7
5 changed files with 73 additions and 12 deletions
|
@ -0,0 +1,31 @@
|
|||
"""Add full text search indexing for repo name and description
|
||||
|
||||
Revision ID: e2894a3a3c19
|
||||
Revises: 45fd8b9869d4
|
||||
Create Date: 2017-01-11 13:55:54.890774
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e2894a3a3c19'
|
||||
down_revision = '45fd8b9869d4'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
def upgrade(tables):
|
||||
if op.get_bind().engine.name == 'postgresql':
|
||||
op.execute('CREATE EXTENSION IF NOT EXISTS pg_trgm')
|
||||
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('repository_description__fulltext', 'repository', ['description'], unique=False, postgresql_using='gin', postgresql_ops={'description': 'gin_trgm_ops'}, mysql_prefix='FULLTEXT')
|
||||
op.create_index('repository_name__fulltext', 'repository', ['name'], unique=False, postgresql_using='gin', postgresql_ops={'name': 'gin_trgm_ops'}, mysql_prefix='FULLTEXT')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('repository_name__fulltext', table_name='repository')
|
||||
op.drop_index('repository_description__fulltext', table_name='repository')
|
||||
# ### end Alembic commands ###
|
Reference in a new issue