Skip to content
Snippets Groups Projects
Commit a01ae5bb authored by Daisuke Akatsuka's avatar Daisuke Akatsuka
Browse files

Bug 1461844: Add bonus for searched visit. r=mak, a=RyanVM

parent 5d063df1
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
});
const FRECENCY = {
TYPED: 100,
SEARCHED: 100,
BOOKMARKED: 175,
};
......@@ -64,7 +64,7 @@ add_task(async function basic() {
resultURL: "https://example.com/?q=abc",
expected: {
source: VISIT_SOURCE_SEARCHED,
frecency: FRECENCY.TYPED,
frecency: FRECENCY.SEARCHED,
},
},
{
......@@ -152,7 +152,7 @@ add_task(async function contextmenu() {
targetURL,
expected: {
source: VISIT_SOURCE_SEARCHED,
frecency: FRECENCY.TYPED,
frecency: FRECENCY.SEARCHED,
},
});
......
......@@ -13,6 +13,7 @@ const FRECENCY = {
ORGANIC: 2000,
SPONSORED: -1,
BOOKMARKED: 2075,
SEARCHED: 100,
};
const {
......@@ -231,7 +232,7 @@ add_task(async function search() {
resultURL: "https://example.com/?q=abc",
expected: {
source: VISIT_SOURCE_SEARCHED,
frecency: FRECENCY.ORGANIC,
frecency: FRECENCY.SEARCHED,
},
},
{
......
......@@ -675,17 +675,19 @@ CalculateFrecencyFunction::OnFunctionCall(mozIStorageValueArray* aArguments,
visitType != nsINavHistoryService::TRANSITION_TYPED);
}
uint32_t visitSource = getVisits->AsInt32(3);
if (hasBookmark) {
// For bookmarked visit, add full bonus.
bonus = history->GetFrecencyTransitionBonus(visitType, true,
useRedirectBonus);
bonus += history->GetFrecencyTransitionBonus(
nsINavHistoryService::TRANSITION_BOOKMARK, true);
} else if (getVisits->AsInt32(3) !=
nsINavHistoryService::VISIT_SOURCE_SPONSORED) {
// For not sponsored visit, add only transition bonus by visit type.
} else if (visitSource == nsINavHistoryService::VISIT_SOURCE_ORGANIC) {
bonus = history->GetFrecencyTransitionBonus(visitType, true,
useRedirectBonus);
} else if (visitSource == nsINavHistoryService::VISIT_SOURCE_SEARCHED) {
bonus = history->GetFrecencyTransitionBonus(
nsINavHistoryService::TRANSITION_LINK, true, useRedirectBonus);
}
// If bonus was zero, we can skip the work to determine the weight.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment