diff --git a/headers/private/file_systems/QueryParser.h b/headers/private/file_systems/QueryParser.h index e6184967a0..e942e15409 100644 --- a/headers/private/file_systems/QueryParser.h +++ b/headers/private/file_systems/QueryParser.h @@ -373,6 +373,7 @@ Equation::Equation(const char** expr) fAttribute(NULL), fString(NULL), fType(0), + fSize(0), fIsPattern(false), fScore(INT32_MAX) { @@ -766,7 +767,13 @@ Equation::CalculateScore(Index &index) // And the code could also need some real world testing :-) // do we have to operate on a "foreign" index? - if (QueryPolicy::IndexSetTo(index, fAttribute) < B_OK) { + if (QueryPolicy::IndexSetTo(index, fAttribute) != B_OK) { + fScore = INT32_MAX; + return; + } + + if (ConvertValue(QueryPolicy::IndexGetType(index), + QueryPolicy::IndexGetKeySize(index)) != B_OK) { fScore = INT32_MAX; return; } @@ -787,7 +794,9 @@ Equation::CalculateScore(Index &index) fScore /= divisor; } else { // Score by operator - if (Term::fOp == OP_EQUAL) { + if (Term::fOp == OP_EQUAL + || Term::fOp == OP_GREATER_THAN + || Term::fOp == OP_GREATER_THAN_OR_EQUAL) { // higher than most patterns fScore /= (fSize > 8) ? 8 : fSize; } else {