зеркало из https://github.com/mozilla/gecko-dev.git
Tweak relevancy computation.
This commit is contained in:
Родитель
9a569a1b91
Коммит
478d0cd974
|
@ -2289,8 +2289,8 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
const PRUnichar *relUni = relItem.GetUnicode();
|
||||
if (relUni)
|
||||
{
|
||||
// take out any characters that aren't numeric or "%"
|
||||
nsAutoString relStr(relUni);
|
||||
// take out any characters that aren't numeric or "%"
|
||||
PRInt32 len = relStr.Length();
|
||||
for (PRInt32 x=len-1; x>=0; x--)
|
||||
{
|
||||
|
@ -2312,24 +2312,31 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
{
|
||||
relStr += PRUnichar('%');
|
||||
}
|
||||
relItem = relStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
relStr = "-";
|
||||
relItem.Truncate();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (relItem.Length() < 1)
|
||||
{
|
||||
relItem = "-";
|
||||
}
|
||||
|
||||
relUni = relStr.GetUnicode();
|
||||
|
||||
const PRUnichar *relItemUni = relItem.GetUnicode();
|
||||
nsCOMPtr<nsIRDFLiteral> relLiteral;
|
||||
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(relUni, getter_AddRefs(relLiteral))))
|
||||
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(relItemUni, getter_AddRefs(relLiteral))))
|
||||
{
|
||||
if (relLiteral)
|
||||
{
|
||||
mDataSource->Assert(res, kNC_Relevance, relLiteral, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((relItem.Length() > 0) && (!relItem.Equals("-")))
|
||||
{
|
||||
// If its a percentage, remove "%"
|
||||
if (relItem[relItem.Length()-1] == PRUnichar('%'))
|
||||
{
|
||||
|
@ -2340,7 +2347,12 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
nsAutoString zero("000");
|
||||
if (relItem.Length() < 3)
|
||||
{
|
||||
relItem.Insert(zero, 0, 3-relItem.Length());
|
||||
relItem.Insert(zero, 0, zero.Length() - relItem.Length());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
relItem = "000";
|
||||
}
|
||||
|
||||
const PRUnichar *relSortUni = relItem.GetUnicode();
|
||||
|
@ -2356,7 +2368,6 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set reference to engine this came from (if it isn't already set)
|
||||
nsCOMPtr<nsIRDFNode> oldEngineRes = nsnull;
|
||||
|
|
|
@ -2289,8 +2289,8 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
const PRUnichar *relUni = relItem.GetUnicode();
|
||||
if (relUni)
|
||||
{
|
||||
// take out any characters that aren't numeric or "%"
|
||||
nsAutoString relStr(relUni);
|
||||
// take out any characters that aren't numeric or "%"
|
||||
PRInt32 len = relStr.Length();
|
||||
for (PRInt32 x=len-1; x>=0; x--)
|
||||
{
|
||||
|
@ -2312,24 +2312,31 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
{
|
||||
relStr += PRUnichar('%');
|
||||
}
|
||||
relItem = relStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
relStr = "-";
|
||||
relItem.Truncate();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (relItem.Length() < 1)
|
||||
{
|
||||
relItem = "-";
|
||||
}
|
||||
|
||||
relUni = relStr.GetUnicode();
|
||||
|
||||
const PRUnichar *relItemUni = relItem.GetUnicode();
|
||||
nsCOMPtr<nsIRDFLiteral> relLiteral;
|
||||
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(relUni, getter_AddRefs(relLiteral))))
|
||||
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(relItemUni, getter_AddRefs(relLiteral))))
|
||||
{
|
||||
if (relLiteral)
|
||||
{
|
||||
mDataSource->Assert(res, kNC_Relevance, relLiteral, PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((relItem.Length() > 0) && (!relItem.Equals("-")))
|
||||
{
|
||||
// If its a percentage, remove "%"
|
||||
if (relItem[relItem.Length()-1] == PRUnichar('%'))
|
||||
{
|
||||
|
@ -2340,7 +2347,12 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
nsAutoString zero("000");
|
||||
if (relItem.Length() < 3)
|
||||
{
|
||||
relItem.Insert(zero, 0, 3-relItem.Length());
|
||||
relItem.Insert(zero, 0, zero.Length() - relItem.Length());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
relItem = "000";
|
||||
}
|
||||
|
||||
const PRUnichar *relSortUni = relItem.GetUnicode();
|
||||
|
@ -2356,7 +2368,6 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set reference to engine this came from (if it isn't already set)
|
||||
nsCOMPtr<nsIRDFNode> oldEngineRes = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче