You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/10/02 10:22:17 UTC
[06/12] lucenenet git commit: Fixed bug in
QueryParser.Surround.Query.DistanceQuery.DistanceSubQueryNotAllowed() that
was causing a null reference exception when the type of query does not
implement IDistanceSubQuery.
Fixed bug in QueryParser.Surround.Query.DistanceQuery.DistanceSubQueryNotAllowed() that was causing a null reference exception when the type of query does not implement IDistanceSubQuery.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f4f94534
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f4f94534
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f4f94534
Branch: refs/heads/master
Commit: f4f94534d902fa8a5ec67b9acc34a6446838f5ce
Parents: 834d91e
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 22 12:38:28 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 22 12:38:28 2016 +0700
----------------------------------------------------------------------
src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f4f94534/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs b/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
index 0cf6fe1..7e4217d 100644
--- a/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
+++ b/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
@@ -51,9 +51,10 @@ namespace Lucene.Net.QueryParsers.Surround.Query
var sqi = GetSubQueriesEnumerator();
while (sqi.MoveNext())
{
- var dsq = sqi.Current as IDistanceSubQuery;
- if (dsq != null)
+ var leq = sqi.Current;
+ if (leq is IDistanceSubQuery)
{
+ var dsq = sqi.Current as IDistanceSubQuery;
string m = dsq.DistanceSubQueryNotAllowed();
if (m != null)
{
@@ -62,7 +63,7 @@ namespace Lucene.Net.QueryParsers.Surround.Query
}
else
{
- return "Operator " + OperatorName + " does not allow subquery " + dsq.ToString();
+ return "Operator " + OperatorName + " does not allow subquery " + leq.ToString();
}
}
return null; /* subqueries acceptable */