mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
GET_subreddits_by_topic: don't search for common words.
This commit is contained in:
@@ -4047,6 +4047,24 @@ class ApiController(RedditController):
|
||||
if not query or len(query) < 2:
|
||||
return []
|
||||
|
||||
# http://en.wikipedia.org/wiki/Most_common_words_in_English
|
||||
common_english_words = {
|
||||
'the', 'be', 'to', 'of', 'and', 'in', 'that', 'have', 'it', 'for',
|
||||
'not', 'on', 'with', 'he', 'as', 'you', 'do', 'at', 'this', 'but',
|
||||
'his', 'by', 'from', 'they', 'we', 'say', 'her', 'she', 'or', 'an',
|
||||
'will', 'my', 'one', 'all', 'would', 'there', 'their', 'what', 'so',
|
||||
'up', 'out', 'if', 'about', 'who', 'get', 'which', 'go', 'me',
|
||||
'when', 'make', 'can', 'like', 'time', 'no', 'just', 'him', 'know',
|
||||
'take', 'people', 'into', 'year', 'your', 'good', 'some', 'could',
|
||||
'them', 'see', 'other', 'than', 'then', 'now', 'look', 'only',
|
||||
'come', 'its', 'over', 'think', 'also', 'back', 'after', 'use',
|
||||
'two', 'how', 'our', 'work', 'first', 'well', 'way', 'even', 'new',
|
||||
'want', 'because', 'any', 'these', 'give', 'day', 'most', 'us',
|
||||
}
|
||||
|
||||
if query.lower() in common_english_words:
|
||||
return []
|
||||
|
||||
exclude = Subreddit.default_subreddits()
|
||||
|
||||
faceting = {"reddit":{"sort":"-sum(text_relevance)", "count":20}}
|
||||
|
||||
Reference in New Issue
Block a user