Made quotes more consistant

This commit is contained in:
Karl Hobley 2014-06-20 15:52:06 +01:00
parent 6d21727b03
commit 67ed563dd7
3 changed files with 36 additions and 36 deletions

View file

@ -65,7 +65,7 @@ class ElasticSearchMapping(object):
doc[field] = getattr(obj, field)
# Check if this field is callable
if hasattr(doc[field], "__call__"):
if hasattr(doc[field], '__call__'):
# Call it
doc[field] = doc[field]()
@ -346,43 +346,43 @@ class ElasticSearch(BaseSearch):
# Settings
INDEX_SETTINGS = {
"settings": {
"analysis": {
"analyzer": {
"ngram_analyzer": {
"type": "custom",
"tokenizer": "lowercase",
"filter": ["ngram"]
'settings': {
'analysis': {
'analyzer': {
'ngram_analyzer': {
'type': 'custom',
'tokenizer': 'lowercase',
'filter': ['ngram']
},
"edgengram_analyzer": {
"type": "custom",
"tokenizer": "lowercase",
"filter": ["edgengram"]
'edgengram_analyzer': {
'type': 'custom',
'tokenizer': 'lowercase',
'filter': ['edgengram']
}
},
"tokenizer": {
"ngram_tokenizer": {
"type": "nGram",
"min_gram": 3,
"max_gram": 15,
'tokenizer': {
'ngram_tokenizer': {
'type': 'nGram',
'min_gram': 3,
'max_gram': 15,
},
"edgengram_tokenizer": {
"type": "edgeNGram",
"min_gram": 2,
"max_gram": 15,
"side": "front"
'edgengram_tokenizer': {
'type': 'edgeNGram',
'min_gram': 2,
'max_gram': 15,
'side': 'front'
}
},
"filter": {
"ngram": {
"type": "nGram",
"min_gram": 3,
"max_gram": 15
'filter': {
'ngram': {
'type': 'nGram',
'min_gram': 3,
'max_gram': 15
},
"edgengram": {
"type": "edgeNGram",
"min_gram": 1,
"max_gram": 15
'edgengram': {
'type': 'edgeNGram',
'min_gram': 1,
'max_gram': 15
}
}
}

View file

@ -49,7 +49,7 @@ class Indexed(object):
if isinstance(indexed_fields, string_types):
indexed_fields = [indexed_fields]
if isinstance(indexed_fields, list):
indexed_fields = dict((field, dict(type="string")) for field in indexed_fields)
indexed_fields = dict((field, dict(type='string')) for field in indexed_fields)
if not isinstance(indexed_fields, dict):
raise ValueError()
@ -139,7 +139,7 @@ class BaseField(object):
return self.get_attname(cls) + self.suffix
def __repr__(self):
return "<%s: %s>" % (self.__class__.__name__, self.field_name)
return '<%s: %s>' % (self.__class__.__name__, self.field_name)
class SearchField(BaseField):

View file

@ -25,13 +25,13 @@ class Command(BaseCommand):
# Loop through objects
for obj in model.objects.all():
# Check if this object has an "object_indexed" function
if hasattr(obj, "object_indexed"):
# Check if this object has an 'object_indexed' function
if hasattr(obj, 'object_indexed'):
if obj.object_indexed() is False:
continue
# Get key for this object
key = toplevel_content_type + ":" + str(obj.pk)
key = toplevel_content_type + ':' + str(obj.pk)
# Check if this key already exists
if key in object_set: