- Fix warning;

- Fix compile error (msvc);
This commit is contained in:
vng 2011-05-18 02:13:40 +03:00 committed by Alex Zolotarev
parent df47837ca0
commit 7fe778c62c
2 changed files with 9 additions and 9 deletions

View file

@ -195,7 +195,7 @@ public:
inline bool HasName() const
{
return Header() & feature::HEADER_HAS_NAME;
return (Header() & feature::HEADER_HAS_NAME) != 0;
}
template <class T>

View file

@ -13,20 +13,20 @@ namespace search
int Score(string const & key, string const & word)
{
size_t const offset = word.find(key);
switch (offset)
if (offset == 0) // best match - from the beginning
{
case 0: // best match - from the beginning
if (word.size() == key.size())
return 1000; // full match
else
return 100; // partial match
break;
case string::npos: // no match
return -1;
break;
default: // match in the middle of the string
return key.size() * 2; // how many symbols matched
}
else if (offset == string::npos) // no match
{
return -1;
}
else // match in the middle of the string
return key.size() * 2; // how many symbols matched
}
Query::Query(string const & line)