[banshee/1.5.1-fixes: 42/56] Look for a field only in the beginning of the token (bgo#601065)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/1.5.1-fixes: 42/56] Look for a field only in the beginning of the token (bgo#601065)
- Date: Mon, 22 Mar 2010 18:07:36 +0000 (UTC)
commit 3534d91eac318738d8be83dfaf2c9ef0b174995c
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date: Sat Nov 14 10:03:39 2009 +1100
Look for a field only in the beginning of the token (bgo#601065)
.../Hyena/Hyena.Query/AliasedObjectSet.cs | 2 +-
src/Libraries/Hyena/Hyena.Query/QueryTermNode.cs | 3 ++-
.../Hyena/Hyena.Query/Tests/QueryTests.cs | 2 ++
3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/Libraries/Hyena/Hyena.Query/AliasedObjectSet.cs b/src/Libraries/Hyena/Hyena.Query/AliasedObjectSet.cs
index 05f1632..ba8ad48 100644
--- a/src/Libraries/Hyena/Hyena.Query/AliasedObjectSet.cs
+++ b/src/Libraries/Hyena/Hyena.Query/AliasedObjectSet.cs
@@ -75,7 +75,7 @@ namespace Hyena.Query
{
input = input.ToLower ();
foreach (string alias in aliases) {
- if (input.Contains (alias)) {
+ if (input.StartsWith (alias)) {
return alias;
}
}
diff --git a/src/Libraries/Hyena/Hyena.Query/QueryTermNode.cs b/src/Libraries/Hyena/Hyena.Query/QueryTermNode.cs
index 094d60f..db523b6 100644
--- a/src/Libraries/Hyena/Hyena.Query/QueryTermNode.cs
+++ b/src/Libraries/Hyena/Hyena.Query/QueryTermNode.cs
@@ -48,11 +48,12 @@ namespace Hyena.Query
string field_alias = field_set.FindAlias (token);
if (field_alias != null) {
term.Field = field_set [field_alias];
+ string token_without_field = token.Substring (field_alias.Length);
foreach (QueryValue val in term.Field.CreateQueryValues ()) {
term.Value = val;
- string op_alias = term.Value.OperatorSet.FindAlias (token);
+ string op_alias = term.Value.OperatorSet.FindAlias (token_without_field);
if (op_alias != null) {
term.Operator = term.Value.OperatorSet [op_alias];
int field_separator = token.IndexOf (op_alias);
diff --git a/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs b/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs
index 2302f3e..5af782f 100644
--- a/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs
+++ b/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs
@@ -141,6 +141,8 @@ namespace Hyena.Query.Tests
"by:baz -on:bar",
"by:baz -on:bar",
"by:baz (plays>3 or plays<2)",
+ "by:on", // bgo#601065
+ "on:by",
};
AssertForEach<string> (tests, UserQueryParsesAndGenerates);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]