diff --git a/es.js b/es.js index 09b4e18..3d94642 100644 --- a/es.js +++ b/es.js @@ -157,9 +157,11 @@ function optionsFromQuery(query) { if (qs.query_string) { var string = unescapeQueryString(qs.query_string.query); var field = qs.query_string.default_field; + var multi_field = qs.query_string.fields; var op = qs.query_string.default_operator; if (string) { opts["q"] = string } if (field) { opts["searchfield"] = field } + if (multi_field) { opts["fields"] = multi_field } if (op) { opts["default_operator"] = op } } else if (qs.match_all) { opts["q"] = "" @@ -281,12 +283,17 @@ function elasticSearchQuery(params) { var querystring = options.q; var searchfield = options.searchfield; var default_operator = options.default_operator; + var search_fields_multi = options.search_fields_multi; + var ftq = undefined; if (querystring) { ftq = {'query_string' : { 'query': fuzzify(querystring, options.default_freetext_fuzzify) }}; if (searchfield) { ftq.query_string["default_field"] = searchfield } + else if (search_fields_multi) { + ftq.query_string["fields"] = search_fields_multi + } if (default_operator) { ftq.query_string["default_operator"] = default_operator } @@ -520,4 +527,3 @@ function doElasticSearchQuery(params) { complete: complete_callback }); } - diff --git a/jquery.facetview2.js b/jquery.facetview2.js index 35febbc..d0513cf 100644 --- a/jquery.facetview2.js +++ b/jquery.facetview2.js @@ -272,6 +272,12 @@ function getUrlVars() { // field on which to focus the freetext search "searchfield" : "", // e.g. title.exact + // fields to search on the freetext search + // NOTE ignored if searchfield is set. + // functionally, searchfield sets 'default_field' in the elasticsearch query + // while search_fields_multi sets 'fields' + "search_fields_multi" : "", // e.g. ["*folded","_all"] + // freetext search string "q" : "",