Skip to content

Commit

Permalink
Merge pull request #232 from CenterForOpenScience/feature/selective_t…
Browse files Browse the repository at this point in the history
…itle_indexing

Feature/selective title indexing
  • Loading branch information
cwisecarver committed Jul 10, 2016
2 parents f502e4b + 2701ee7 commit 3a551e8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions share/disambiguation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def __init__(self, id, attrs, model):
def disambiguate(self):
if not self.attrs:
return None
if len(self.attrs.get('title','')) > 2048:
return None
self.attrs.pop('description', None)
return self.model.objects.filter(**self.attrs).first()


Expand Down
18 changes: 18 additions & 0 deletions share/migrations/0017_create_partial_index_on_title.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-10 17:23
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('share', '0016_auto_20160709_1917'),
]

operations = [
migrations.RunSQL(
"CREATE INDEX share_abstractcreativework_title_not_too_long ON share_abstractcreativework (title ASC) WHERE octet_length(title) < 2049;"
)
]

0 comments on commit 3a551e8

Please sign in to comment.