Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 23840 - Smart playlist does not work properly
Use searchable instead of sortable for smart playlists searching.

r=msmith/jwatts

git-svn-id: http://publicsvn.songbirdnest.com/client/trunk@21181 5aad4ff5-4b58-4159-ba3f-0e6328df4cad
  • Loading branch information
dbradley committed May 16, 2011
1 parent 660655f commit 90a9fa4
Showing 1 changed file with 11 additions and 12 deletions.
Expand Up @@ -1523,7 +1523,6 @@ sbLocalDatabaseSmartMediaList::CreateSQLForCondition(sbRefPtrCondition& aConditi
NS_NAMED_LITERAL_STRING(kMediaLists, "simple_media_lists");
NS_NAMED_LITERAL_STRING(kMediaItemsAlias, "_mi");
NS_NAMED_LITERAL_STRING(kMediaListTypeId, "media_list_type_id");
NS_NAMED_LITERAL_STRING(kObjSortable, "obj_sortable");
NS_NAMED_LITERAL_STRING(kPropertyId, "property_id");
NS_NAMED_LITERAL_STRING(kResourceProperties, "resource_properties");

Expand Down Expand Up @@ -1799,7 +1798,7 @@ sbLocalDatabaseSmartMediaList::AddCriterionForCondition(sbISQLSelectBuilder* aBu
NS_ENSURE_ARG_POINTER(aInfo);

NS_NAMED_LITERAL_STRING(kConditionAlias, "_c");
NS_NAMED_LITERAL_STRING(kObjSortable, "obj_sortable");
NS_NAMED_LITERAL_STRING(kObjSearchable, "obj_searchable");
NS_NAMED_LITERAL_STRING(kMediaItem, "media_item_id");

nsresult rv;
Expand All @@ -1817,7 +1816,7 @@ sbLocalDatabaseSmartMediaList::AddCriterionForCondition(sbISQLSelectBuilder* aBu
NS_ENSURE_SUCCESS(rv, rv);
}
else {
columnName.Assign(kObjSortable);
columnName.Assign(kObjSearchable);
}

nsCOMPtr<sbIPropertyOperator> opObj;
Expand Down Expand Up @@ -1924,10 +1923,10 @@ sbLocalDatabaseSmartMediaList::AddCriterionForCondition(sbISQLSelectBuilder* aBu
}

if (!leftValue.IsEmpty()) {
rv = aInfo->MakeSortable(leftValue, value);
// MakeSortable may fail if the value fails to validate, but since a smart
rv = aInfo->MakeSearchable(leftValue, value);
// MakeSearchable may fail if the value fails to validate, but since a smart
// playlist may look for substrings instead of full valid values, it is not
// fatal to fail to make sortable, when that fails we just use the value
// fatal to fail to make searchable, when that fails we just use the value
// that we were given as is and escape it properly.
if (NS_FAILED(rv)) {
nsCOMPtr<nsINetUtil> netUtil =
Expand Down Expand Up @@ -1960,10 +1959,10 @@ sbLocalDatabaseSmartMediaList::AddCriterionForCondition(sbISQLSelectBuilder* aBu
NS_ENSURE_SUCCESS(rv, rv);

nsAutoString rvalue;
rv = aInfo->MakeSortable(rightValue, rvalue);
// MakeSortable may fail if the value fails to validate, but since a smart
rv = aInfo->MakeSearchable(rightValue, rvalue);
// MakeSearchable may fail if the value fails to validate, but since a smart
// playlist may look for substrings instead of full valid values, it is not
// fatal to fail to make sortable, when that fails we just use the value
// fatal to fail to make searchable, when that fails we just use the value
// that we were given as is.
if (NS_FAILED(rv)) {
rvalue = rightValue;
Expand Down Expand Up @@ -2253,10 +2252,10 @@ sbLocalDatabaseSmartMediaList::GetConditionNeedsNull(sbRefPtrCondition& aConditi
nsAutoString leftValue, value;
leftValue = aCondition->mLeftValue;
if (!leftValue.IsEmpty()) {
rv = aInfo->MakeSortable(leftValue, value);
// MakeSortable may fail if the value fails to validate, but since a smart
rv = aInfo->MakeSearchable(leftValue, value);
// MakeSearchable may fail if the value fails to validate, but since a smart
// playlist may look for substrings instead of full valid values, it is not
// fatal to fail to make sortable, when that fails we just use the value
// fatal to fail to make searchable, when that fails we just use the value
// that we were given as is.
if (NS_FAILED(rv)) {
value = leftValue;
Expand Down

0 comments on commit 90a9fa4

Please sign in to comment.