Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLAT-10234:esearch reduce results in partial search #8818

Merged
merged 8 commits into from Oct 22, 2019

Conversation

@ravitshalem
Copy link
Contributor

ravitshalem commented Oct 17, 2019

No description provided.

@@ -118,6 +137,16 @@ public static function getPartialQuery($searchItem, $fieldName, &$queryAttribute
return $partialQuery;
}
protected static function isPartnerShouldReduceResults($partnerId)

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

rename - shouldReduceResults($partnerId)

if ($shouldReduceResults)
{
$matchQuery->setOperator(self::OP_AND);
$cuttOffFreq = kConf::get('cutoff_frequency','elasticDynamicMap');

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor
  1. Add const to map name - elasticDynamicMap
  2. Add const to cutoff_frequency
  3. create function getCutoffFreq() and move the call inside

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

Add default value to the kconf call

if ($shouldReduceResults)
{
$multiMatchQuery->setOperator(self::OP_AND);

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

rename - OP_AND to OPERATOR_AND

if($searchItem->getAddHighlight())
$queryAttributes->getQueryHighlightsAttributes()->addFieldToHighlight($fieldName, $trigramFieldName);
$partialQuery->addToShould($matchQuery);
$maxWordsForNgram = kConf::get('max_words_for_ngram','elasticDynamicMap');

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

Use const for max_words_for_ngram

$partialQuery->addToShould($matchQuery);
$maxWordsForNgram = kConf::get('max_words_for_ngram','elasticDynamicMap');
$splitedSearchTerms = preg_split('/\s+/', $searchItem->getSearchTerm());
if (!$shouldReduceResults || ($shouldReduceResults && isset($maxWordsForNgram) && count($splitedSearchTerms) <= $maxWordsForNgram))

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

shouldUseNgram($maxWordsForNgram,$term)

@@ -118,6 +137,16 @@ public static function getPartialQuery($searchItem, $fieldName, &$queryAttribute
return $partialQuery;
}
protected static function isPartnerShouldReduceResults($partnerId)
{
$elasticReduceResultsPartners = kConf::get('reduced_results_partner_list','elasticDynamicMap');

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

reduced_results_partner_list us const

@@ -118,6 +137,16 @@ public static function getPartialQuery($searchItem, $fieldName, &$queryAttribute
return $partialQuery;
}
protected static function isPartnerShouldReduceResults($partnerId)
{
$elasticReduceResultsPartners = kConf::get('reduced_results_partner_list','elasticDynamicMap');

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

Add default value of array()

if($searchItem->getAddHighlight())
$queryAttributes->getQueryHighlightsAttributes()->addFieldToHighlight($fieldName, $trigramFieldName);
$partialQuery->addToShould($matchQuery);
$maxWordsForNgram = kConf::get('max_words_for_ngram','elasticDynamicMap');

This comment has been minimized.

Copy link
@MosheMaorKaltura

MosheMaorKaltura Oct 22, 2019

Contributor

Add default value CONST 1 ( in plugin file)

ravitshalem added 3 commits Oct 22, 2019
…server into Orion-15.9.0-PLAT-10234
@ravitshalem ravitshalem merged commit b68ef9b into Orion-15.9.0 Oct 22, 2019
2 checks passed
2 checks passed
Datree Smart Policy Best Practices Verification
Details
Datree insights datreeio insights events
Details
@ravitshalem ravitshalem deleted the Orion-15.9.0-PLAT-10234 branch Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.