summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3540ef9)
- from django.conf import settings
- CAN_USE = settings.DATABASE_ENGINE in ('mysql', 'pooled_mysql')
-except:
+ import settings_local
+ CAN_USE = settings_local.DATABASE_ENGINE in ('mysql', 'pooled_mysql')
+except Exception, e:
+ import traceback
+ traceback.print_exc()
CAN_USE = False
\ No newline at end of file
CAN_USE = False
\ No newline at end of file
class MysqlFtsIndex(models.Model):
node = models.OneToOneField('Node', related_name='ftsindex')
body = models.TextField()
class MysqlFtsIndex(models.Model):
node = models.OneToOneField('Node', related_name='ftsindex')
body = models.TextField()
+ title = models.CharField(max_length=300)
+ tagnames = models.CharField(max_length=255)
class Meta:
managed = False
class Meta:
managed = False
keywords = keywords.upper()
return '-ranking', self.filter(
keywords = keywords.upper()
return '-ranking', self.filter(
- models.Q(ftsindex__body__search=keywords) or models.Q(ftsindex__title__search=keywords) or models.Q(ftsindex__tagnames__search=keywords)
-
+ models.Q(ftsindex__body__isnull=False)
).extra(
select={
'ranking': """
).extra(
select={
'ranking': """
- match(forum_mysqlftsindex.tagnames) against (%s in boolean mode) * 4 +
- match(forum_mysqlftsindex.title) against (%s in boolean mode) * 2 +
- match(forum_mysqlftsindex.body) against (%s in boolean mode) * 1
+ match(forum_mysqlftsindex.tagnames) against (%s) * 2 +
+ match(forum_mysqlftsindex.title) against (%s) * 4 +
+ match(forum_mysqlftsindex.body) against (%s) * 1
""",
},
select_params=[keywords, keywords, keywords]
""",
},
select_params=[keywords, keywords, keywords]