Commit ec1993e3 authored by Romain Loth's avatar Romain Loth

autocomplete for keywords and hashtags via ajax with /api/aggs?field=...

parent bee9be79
......@@ -194,8 +194,20 @@ def aggs_api():
API to read DB aggregation data (ex: for autocompletes)
"""
if 'field' in request.args:
# field name itself is tested by db module
result = db.get_field_aggs(request.args['field'])
hap_thresh = None
if 'hapax' in request.args:
try:
hap_thresh = int(request.args['hapax'])
print("new hap_thresh", hap_thresh)
except:
pass
if hap_thresh is not None:
# field name itself is tested by db module
result = db.get_field_aggs(request.args['field'], hapax_threshold=hap_thresh)
else:
result = db.get_field_aggs(request.args['field'])
return dumps(result)
else:
raise TypeError("aggs API query is missing 'field' argument")
......
......@@ -333,3 +333,46 @@ input.is-realperson {
#btn-midname {
opacity: .8;
}
.ui-menu-item {
color: #337AB7 !important;
font-family: "Droid Sans", Calibri, "Helvetica Neue", Helvetica, sans-serif;
letter-spacing:normal;
}
.ui-menu-item:hover {
color: #fff !important;
font-weight: bold !important;
}
/*.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
margin: 2px 0 0 0;
list-style: none;
background-color: #ffffff;
border-color: #ccc;
border-color: rgba(0, 0, 0, 0.2);
border-style: solid;
border-width: 1px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
*border-right-width: 2px;
*border-bottom-width: 2px;
}*/
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment