def get_terms(request): result = {'status': -1, 'message': 'Error'} try: collection = json.loads(request.POST.get('collection', '{}')) analysis = json.loads(request.POST.get('analysis', '{}')) field = analysis['name'] properties = { 'terms.limit': 25, 'terms.prefix': analysis['terms']['prefix'] # lower # limit # mincount # maxcount } result['terms'] = SolrApi(SOLR_URL.get(), request.user).terms(collection['name'], field, properties) result['terms'] = pairwise2(field, [], result['terms']['terms'][field]) result['status'] = 0 result['message'] = '' except Exception, e: result['message'] = force_unicode(e) if 'not currently supported' in result['message']: result['status'] = 1 result['message'] = _('This field does not support stats')
def get_terms(request): result = {'status': -1, 'message': 'Error'} try: collection = json.loads(request.POST.get('collection', '{}')) analysis = json.loads(request.POST.get('analysis', '{}')) field = analysis['name'] properties = { 'terms.limit': 25, 'terms.prefix': analysis['terms']['prefix'] # lower # limit # mincount # maxcount } result['terms'] = SolrApi(SOLR_URL.get(), request.user).terms(collection['name'], field, properties) result['terms'] = pairwise2(field, [], result['terms']['terms'][field]) result['status'] = 0 result['message'] = '' except Exception, e: result['message'] = unicode(str(e), "utf8") if 'not currently supported' in result['message']: result['status'] = 1 result['message'] = _('This field does not support stats')
def get_terms(request): result = {"status": -1, "message": "Error"} try: collection = json.loads(request.POST.get("collection", "{}")) analysis = json.loads(request.POST.get("analysis", "{}")) field = analysis["name"] properties = { "terms.limit": 25, "terms.prefix": analysis["terms"]["prefix"] # lower # limit # mincount # maxcount } result["terms"] = SolrApi(SOLR_URL.get(), request.user).terms(collection["name"], field, properties) result["terms"] = pairwise2(field, [], result["terms"]["terms"][field]) result["status"] = 0 result["message"] = "" except Exception, e: result["message"] = force_unicode(e) if "not currently supported" in result["message"]: result["status"] = 1 result["message"] = _("This field does not support stats")