Minor refactor.

This commit is contained in:
Kishore Nallan 2018-03-24 15:43:36 +05:30
parent 928b5602de
commit c39fd39f2d
2 changed files with 4 additions and 4 deletions

View File

@ -96,6 +96,7 @@
- ~~gzip compress responses~~
- ~~Have a LOG(ERROR) level~~
- ~~Handle SIGTERM which is sent when process is killed~~
- Log operations
- Parameterize replica's MAX_UPDATES_TO_SEND
- NOT operator support
- > INT32_MAX validation for float field

View File

@ -628,7 +628,6 @@ void Index::search_field(std::string & query, const std::string & field, uint32_
StringUtils::split(query, tokens, " ");
const size_t max_cost = (num_typos < 0 || num_typos > 2) ? 2 : num_typos;
const size_t max_results = Index::SEARCH_LIMIT_NUM;
size_t total_results = topster.size;
@ -736,9 +735,9 @@ void Index::search_field(std::string & query, const std::string & field, uint32_
// If all tokens were found, go ahead and search for candidates with what we have so far
search_candidates(filter_ids, filter_ids_length, facets, sort_fields, token_candidates_vec,
token_order, searched_queries, topster, total_results, all_result_ids, all_result_ids_len,
max_results, prefix);
Index::SEARCH_LIMIT_NUM, prefix);
if (total_results >= max_results) {
if (total_results >= Index::SEARCH_LIMIT_NUM) {
// If we don't find enough results, we continue outerloop (looking at tokens with greater cost)
break;
}
@ -748,7 +747,7 @@ void Index::search_field(std::string & query, const std::string & field, uint32_
}
// When there are not enough overall results and atleast one token has results
if(topster.size < max_results && token_to_count.size() > 1) {
if(topster.size < Index::SEARCH_LIMIT_NUM && token_to_count.size() > 1) {
// Drop token with least hits and try searching again
std::string truncated_query;