Skip to content

Commit

Permalink
min_score support
Browse files Browse the repository at this point in the history
  • Loading branch information
gneissone committed May 25, 2016
1 parent 3d3f835 commit 13377a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bootstrap3.facetview.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function searchOptions(options) {
<button id="btnGroupDrop1" type="button" class="btn btn-custom dropdown-toggle \
" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> \
Sort by... <span class="caret"></span></button> <ul class="dropdown-menu" \
aria-labelledby="btnGroupDrop1"> <li><a class="dropdown-item facetview_orderby" id="_score" href="_score">Relevance</a></li>';
aria-labelledby="btnGroupDrop1">';

for (var each = 0; each < options.search_sortby.length; each++) {
var obj = options.search_sortby[each];
Expand Down
9 changes: 7 additions & 2 deletions es.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ function elasticSearchQuery(params) {
var searchfield = options.searchfield;
var default_operator = options.default_operator;
var search_fields_multi = options.search_fields_multi;

var min_score = options.min_score;

var ftq = undefined;
if (querystring) {
ftq = {'query_string' : { 'query': fuzzify(querystring, options.default_freetext_fuzzify) }};
Expand All @@ -300,7 +301,11 @@ function elasticSearchQuery(params) {
} else {
ftq = {"match_all" : {}}
}


if (min_score) {
qs['min_score'] = min_score;
}

// if there are filter constraints (filter_must) then we create a filtered query,
// otherwise make a normal query
var qs = undefined;
Expand Down
4 changes: 4 additions & 0 deletions jquery.facetview2.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ function getUrlVars() {
// while search_fields_multi sets 'fields'
"search_fields_multi" : "", // e.g. ["*folded","_all"]

// minimum score for returned free text query results
// usually only necessary if searching a field indexed using an ngram analyzer
"min_score" : null,

// freetext search string
"q" : "",

Expand Down

0 comments on commit 13377a5

Please sign in to comment.