зеркало из https://github.com/mozilla/kitsune.git
Kill the `age` field.
It's just the inverse of `updated`, and we don't want to figure out how to do math in the ES indexing.
This commit is contained in:
Родитель
d0cadecf72
Коммит
37b54d1a4a
|
@ -24,7 +24,7 @@ DATE_LIST = (
|
|||
)
|
||||
|
||||
GROUPSORT = (
|
||||
('-@relevance', 'age'), # default
|
||||
('-@relevance', '-updated'), # default
|
||||
'-updated',
|
||||
'-created',
|
||||
'-replies',
|
||||
|
@ -65,7 +65,7 @@ NUMBER_LIST = (
|
|||
)
|
||||
|
||||
SORT_QUESTIONS = (
|
||||
('-@relevance', 'age'), # default
|
||||
('-@relevance', '-updated'), # default
|
||||
('-updated',),
|
||||
('-created',),
|
||||
('-replies',)
|
||||
|
|
|
@ -18,15 +18,3 @@ ETC_PATH = '/etc'
|
|||
LISTEN_PORT = 3381
|
||||
LISTEN_SQL_HOST = 'localhost'
|
||||
LISTEN_SQL_PORT = 3382
|
||||
|
||||
## Age divisor
|
||||
# We convert the |age| attribute from the |forum_thread| index into a more
|
||||
# useful unit than seconds. In the list below, to convert to <unit> assign
|
||||
# this to <value>
|
||||
# <unit> : <value>
|
||||
# second : 1
|
||||
# minute : 60
|
||||
# hour : 3600
|
||||
# day : 86400
|
||||
# week : 604800
|
||||
AGE_DIVISOR = 86400
|
||||
|
|
|
@ -33,5 +33,3 @@ ROOT_PATH = settings.TEST_SPHINX_PATH
|
|||
CATALOG_PATH = '/data'
|
||||
LOG_PATH = '/log'
|
||||
ETC_PATH = '/etc'
|
||||
|
||||
AGE_DIVISOR = 86400
|
||||
|
|
|
@ -128,8 +128,7 @@ source questions
|
|||
a.creator_id = auth_user.id \
|
||||
) AS answer_creator, \
|
||||
q.num_votes_past_week AS question_votes, \
|
||||
a.upvotes AS answer_votes, \
|
||||
(UNIX_TIMESTAMP() - q.updated)/{age_unit} AS age \
|
||||
a.upvotes AS answer_votes \
|
||||
FROM \
|
||||
questions_question q \
|
||||
LEFT JOIN \
|
||||
|
@ -148,7 +147,6 @@ source questions
|
|||
sql_attr_uint = answer_creator
|
||||
sql_attr_uint = question_votes
|
||||
sql_attr_uint = answer_votes
|
||||
sql_attr_uint = age
|
||||
|
||||
sql_attr_multi = uint tag from query; SELECT \
|
||||
IF(a.id, q.id * 10e{n} + a.id, q.id * 10e{n}) AS id, \
|
||||
|
@ -174,7 +172,7 @@ source questions
|
|||
taggit_tag t \
|
||||
ON t.id = ti.tag_id
|
||||
}}
|
||||
""".format(mysql=MYSQL, age_unit=AGE_DIVISOR, n=ID_FACTOR)
|
||||
""".format(mysql=MYSQL, n=ID_FACTOR)
|
||||
|
||||
config = config + """
|
||||
index questions
|
||||
|
@ -217,7 +215,6 @@ source discussion_forums
|
|||
WHERE \
|
||||
forums_post.id = thread.last_post_id \
|
||||
) AS updated, \
|
||||
(UNIX_TIMESTAMP() - post.updated)/{age_unit} AS age, \
|
||||
thread.replies AS replies \
|
||||
FROM \
|
||||
forums_post AS post \
|
||||
|
@ -234,11 +231,10 @@ source discussion_forums
|
|||
sql_attr_uint = author_ord
|
||||
sql_attr_timestamp = created
|
||||
sql_attr_timestamp = updated
|
||||
sql_attr_uint = age
|
||||
sql_attr_uint = replies
|
||||
|
||||
}}
|
||||
""".format(mysql=MYSQL, age_unit=AGE_DIVISOR)
|
||||
""".format(mysql=MYSQL)
|
||||
|
||||
config = config + """
|
||||
index discussion_forums
|
||||
|
|
Загрузка…
Ссылка в новой задаче