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:20 UTC

[09/12] lucenenet git commit: Added missing QueryParser.Analyzing.AnalyzingQueryParser.GetPrefixQuery override that was causing the TestAnalyzingQueryParser.TestPrefixQuery() test to fail.

Added missing QueryParser.Analyzing.AnalyzingQueryParser.GetPrefixQuery override that was causing the TestAnalyzingQueryParser.TestPrefixQuery() test to fail.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/97bd5828
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/97bd5828
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/97bd5828

Branch: refs/heads/master
Commit: 97bd5828a386bbe90e3ccc301fa4ec68bc2e0ae6
Parents: dee8fb4
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Sep 22 15:46:44 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 22 15:46:44 2016 +0700

----------------------------------------------------------------------
 .../Analyzing/AnalyzingQueryParser.cs           | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/97bd5828/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs b/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
index 434f668..34c50db 100644
--- a/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
+++ b/src/Lucene.Net.QueryParser/Analyzing/AnalyzingQueryParser.cs
@@ -110,6 +110,27 @@ namespace Lucene.Net.QueryParsers.Analyzing
         }
 
         /// <summary>
+        /// Called when parser parses an input term
+        /// that uses prefix notation; that is, contains a single '*' wildcard
+        /// character as its last character.Since this is a special case
+        /// of generic wildcard term, and such a query can be optimized easily,
+        /// this usually results in a different query object.
+        /// <p>
+        /// Depending on analyzer and settings, a prefix term may (most probably will)
+        /// be lower-cased automatically. It <b>will</b> go through the default Analyzer.
+        /// <p>
+        /// Overrides super class, by passing terms through analyzer.
+        /// </summary>
+        /// <param name="field">Name of the field query will use.</param>
+        /// <param name="termStr">Term to use for building term for the query (<b>without</b> trailing '*' character!)</param>
+        /// <returns>Resulting <see cref="Query"/> built for the term</returns>
+        protected internal override Query GetPrefixQuery(string field, string termStr)
+        {
+            string analyzed = AnalyzeSingleChunk(field, termStr, termStr);
+            return base.GetPrefixQuery(field, analyzed);
+        }
+
+        /// <summary>
         /// Called when parser parses an input term that has the fuzzy suffix (~) appended.
         /// <p>
         /// Depending on analyzer and settings, a fuzzy term may (most probably will)