You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/06/22 05:25:32 UTC

[31/38] lucenenet git commit: Lucene.Net.Search.NGramPhraseQuery: Added documentation to show usage of collection initializer

Lucene.Net.Search.NGramPhraseQuery: Added documentation to show usage of collection initializer


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

Branch: refs/heads/master
Commit: 121684b7a929de22aa637c9e016981f7f5c4adb6
Parents: 2de9a6a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Jun 21 23:55:05 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jun 22 00:13:03 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net/Search/NGramPhraseQuery.cs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/121684b7/src/Lucene.Net/Search/NGramPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Search/NGramPhraseQuery.cs b/src/Lucene.Net/Search/NGramPhraseQuery.cs
index 2f208ae..7ad97e8 100644
--- a/src/Lucene.Net/Search/NGramPhraseQuery.cs
+++ b/src/Lucene.Net/Search/NGramPhraseQuery.cs
@@ -29,6 +29,20 @@ namespace Lucene.Net.Search
     /// <see cref="NGramPhraseQuery"/> rather than <see cref="PhraseQuery"/>, because <see cref="NGramPhraseQuery"/>
     /// will <see cref="Rewrite(IndexReader)"/> the query to "AB/0 CD/2", while <see cref="PhraseQuery"/>
     /// will query "AB/0 BC/1 CD/2" (where term/position).
+    /// <para/>
+    /// Collection initializer note: To create and populate a <see cref="PhraseQuery"/>
+    /// in a single statement, you can use the following example as a guide:
+    /// 
+    /// <code>
+    /// var phraseQuery = new NGramPhraseQuery(2) {
+    ///     new Term("field", "ABCD"), 
+    ///     new Term("field", "EFGH")
+    /// };
+    /// </code>
+    /// Note that as long as you specify all of the parameters, you can use either
+    /// <see cref="PhraseQuery.Add(Term)"/> or <see cref="PhraseQuery.Add(Term, int)"/>
+    /// as the method to use to initialize. If there are multiple parameters, each parameter set
+    /// must be surrounded by curly braces.
     /// </summary>
 #if FEATURE_SERIALIZABLE
     [Serializable]