Skip to content

Instantly share code, notes, and snippets.

@ngokevin
ngokevin / searchsuggesttouch
Created December 13, 2012 03:47
Why search suggestions weren't working on touch devices (bug 818013)
The problem was that setInterval would fire off multiple duplicate requests per
second. On each subsequent request would abort the previous request in
processRequest. ajaxCache would store the arguments in the first requests and
not serve the subsequent ones. To handle this, we keep track of the previous
search and only send an ajaxCache request if the search is different from the
previous one. This prevents multiple duplicate requests from blocking each
other by only having one of them be able to make the request.
There is still the problem of backspacing in search suggestions. On each letter
I add to my search query, an ajaxCache request is fired off. As I add more
159 E101 indentation contains mixed spaces and tabs
232 E111 indentation is not a multiple of four
3 E113 unexpected indentation
502 E121 continuation line indentation is not a multiple of four
72 E122 continuation line missing indentation or outdented
292 E123 closing bracket does not match indentation of opening bracket's line
141 E124 closing bracket does not match visual indentation
161 E125 continuation line does not distinguish itself from next logical line
468 E126 continuation line over-indented for hanging indent
735 E127 continuation line over-indented for visual indent
1 import jinja2
2
3 from jingo import register
4
5 from mkt.stats.views import check_stats_permission
6
7
8 @register.function
9 @jinja2.contextfunction
10 def check_stats_perms(request, addon, for_contributions=True):
SearchPhaseExecutionException: Failed to execute phase [query], total failure;
shardFailures {[yawHAyHkSrqlLjoguw8sbg][amo][2]: SearchParseException[[amo][2]:
from[-1],size[6]: Parse Failure [Failed to parse source [{"filter": {"and":
[{"term": {"status": 4}}, {"term": {"type": 11}}, {"term": {"is_disabled":
false}}]}, "fields": ["id"], "size": 6, "sort": [{"weekly_downloads":
"desc"}]}]]]; nested: SearchParseException[[amo][2]: from[-1],size[6]: Parse
Failure [No mapping found for [weekly_downloads] in order to sort on]];
}{[yawHAyHkSrqlLjoguw8sbg][amo][0]: SearchParseException[[amo][0]:
from[-1],size[6]: Parse Failure [Failed to parse source [{"filter": {"and":
[{"term": {"status": 4}}, {"term": {"type": 11}}, {"term": {"is_disabled":
@ngokevin
ngokevin / gist:2720677
Created May 17, 2012 18:15
estraceback
SearchPhaseExecutionException: Failed to execute phase [query], total failure; shardFailures {[yawHAyHkSrqlLjoguw8sbg][amo][2]: SearchParseException[[amo][2]: from[-1],size[6]: Parse Failure [Failed to parse source [{"filter": {"and": [{"term": {"status": 4}}, {"term": {"type": 11}}, {"term": {"is_disabled": false}}]}, "fields": ["id"], "size": 6, "sort": [{"weekly_downloads": "desc"}]}]]]; nested: SearchParseException[[amo][2]: from[-1],size[6]: Parse Failure [No mapping found for [weekly_downloads] in order to sort on]]; }{[yawHAyHkSrqlLjoguw8sbg][amo][0]: SearchParseException[[amo][0]: from[-1],size[6]: Parse Failure [Failed to parse source [{"filter": {"and": [{"term": {"status": 4}}, {"term": {"type": 11}}, {"term": {"is_disabled": false}}]}, "fields": ["id"], "size": 6, "sort": [{"weekly_downloads": "desc"}]}]]]; nested: SearchParseException[[amo][0]: from[-1],size[6]: Parse Failure [No mapping found for [weekly_downloads] in order to sort on]]; }{[yawHAyHkSrqlLjoguw8sbg][amo][3]: SearchParseException[[
@ngokevin
ngokevin / gist:2704202
Created May 15, 2012 18:58
merge conflict
(zamboni)ngoke@mozzarella:~/Code/zamboni/apps$ git pull mozilla master
From github.com:mozilla/zamboni
* branch master -> FETCH_HEAD
Auto-merging templates/qunit/qunit.html
CONFLICT (content): Merge conflict in templates/qunit/qunit.html
Auto-merging mkt/settings.py
Auto-merging mkt/inapp_pay/views.py
Auto-merging mkt/asset_bundles.py
Auto-merging mkt/account/views.py
Auto-merging media/js/zamboni/tests/install_button_tests.js
SearchPhaseExecutionException: Failed to execute phase [query], total failure; shardFailures {[LR5E1PJ3REOSpig3X4IV9Q][amo_stats][0]: SearchParseException[[amo_stats][0]: from[-1],size[365]: Parse Failure [Failed to parse source [{"filter": {"term": {"addon": 8}}, "fields": ["id", "date", "count"], "size": 365, "sort": [{"date": "desc"}]}]]]; nested: SearchParseException[[amo_stats][0]: from[-1],size[365]: Parse Failure [No mapping found for [date] in order to sort on]]; }{[LR5E1PJ3REOSpig3X4IV9Q][amo_stats][2]: SearchParseException[[amo_stats][2]: from[-1],size[365]: Parse Failure [Failed to parse source [{"filter": {"term": {"addon": 8}}, "fields": ["id", "date", "count"], "size": 365, "sort": [{"date": "desc"}]}]]]; nested: SearchParseException[[amo_stats][2]: from[-1],size[365]: Parse Failure [No mapping found for [date] in order to sort on]]; }{[LR5E1PJ3REOSpig3X4IV9Q][amo_stats][3]: SearchParseException[[amo_stats][3]: from[-1],size[365]: Parse Failure [Failed to parse source [{"filter": {"term": {"addo
SearchPhaseExecutionException: Failed to execute phase [query], total failure; shardFailures {[LR5E1PJ3REOSpig3X4IV9Q][amo_stats][0]: SearchParseException[[amo_stats][0]: from[-1],size[365]: Parse Failure [Failed to parse source [{"filter": {"term": {"addon": 8}}, "fields": ["id", "date", "count"], "size": 365, "sort": [{"date": "desc"}]}]]]; nested: SearchParseException[[amo_stats][0]: from[-1],size[365]: Parse Failure [No mapping found for [date] in order to sort on]]; }{[LR5E1PJ3REOSpig3X4IV9Q][amo_stats][2]: SearchParseException[[amo_stats][2]: from[-1],size[365]: Parse Failure [Failed to parse source [{"filter": {"term": {"addon": 8}}, "fields": ["id", "date", "count"], "size": 365, "sort": [{"date": "desc"}]}]]]; nested: SearchParseException[[amo_stats][2]: from[-1],size[365]: Parse Failure [No mapping found for [date] in order to sort on]]; }{[LR5E1PJ3REOSpig3X4IV9Q][amo_stats][3]: SearchParseException[[amo_stats][3]: from[-1],size[365]: Parse Failure [Failed to parse source [{"filter": {"term": {"addo
@ngokevin
ngokevin / gist:2629972
Created May 7, 2012 19:54
zamboni index traceback
(zamboni)ngoke@mozzarella:~/Code/zamboni$ python manage.py cron reindex_addons
12:51:20 rdflib:INFO version: 3.0.0 :/home/ngoke/Code/zamboni/vendor/lib/python/rdflib/__init__.py:61
12:51:20 cron:INFO Beginning job: reindex_addons () :/home/ngoke/Code/zamboni/vendor/src/django-cronjobs/cronjobs/management/commands/cron.py:63
12:51:20 pyes:DEBUG Connecting to 127.0.0.1:9200 :/home/ngoke/Code/zamboni/vendor/lib/python/pyes/connection_http.py:194
12:51:20 pyes:INFO Starting new HTTP connection (1): 127.0.0.1 :/home/ngoke/Code/zamboni/vendor/lib/python/pyes/connection_http.py:34
12:51:21 pyes.urllib3.connectionpool:DEBUG "PUT /amo HTTP/1.1" 200 31 :/home/ngoke/Code/zamboni/vendor/lib/python/pyes/urllib3/connectionpool.py:274
12:51:21 pyes.urllib3.connectionpool:DEBUG "PUT /amo/addons/_mapping HTTP/1.1" 400 112 :/home/ngoke/Code/zamboni/vendor/lib/python/pyes/urllib3/connectionpool.py:274
12:51:21 z.es:ERROR Analyzer [standardPlusWordDelimiter] not found for field [name] :/home/ngoke/Code/zamboni/apps/addons/search
@ngokevin
ngokevin / gist:2629965
Created May 7, 2012 19:53
zamboni elastic search traceback
Traceback (most recent call last):
File "/home/ngoke/Code/zamboni/vendor/src/django/django/core/servers/basehttp.py", line 283, in run
self.result = application(self.environ, self.start_response)
File "/home/ngoke/Code/zamboni/vendor/src/django/django/contrib/staticfiles/handlers.py", line 68, in __call__
return self.application(environ, start_response)
File "/home/ngoke/Code/zamboni/vendor/src/django/django/core/handlers/wsgi.py", line 272, in __call__
response = self.get_response(request)