Lucene.Net.Search.BooleanQuery: 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/56d6d6d0 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/56d6d6d0 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/56d6d6d0 Branch: refs/heads/master Commit: 56d6d6d04586f6caa3f072733944ee56cbf27eea Parents: f674dc6 Author: Shad Storhaug <[email protected]> Authored: Wed Jun 21 23:52:07 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Jun 22 00:13:02 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net/Search/BooleanQuery.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56d6d6d0/src/Lucene.Net/Search/BooleanQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Search/BooleanQuery.cs b/src/Lucene.Net/Search/BooleanQuery.cs index b144393..bbf0699 100644 --- a/src/Lucene.Net/Search/BooleanQuery.cs +++ b/src/Lucene.Net/Search/BooleanQuery.cs @@ -39,6 +39,29 @@ namespace Lucene.Net.Search /// A <see cref="Query"/> that matches documents matching boolean combinations of other /// queries, e.g. <see cref="TermQuery"/>s, <see cref="PhraseQuery"/>s or other /// <see cref="BooleanQuery"/>s. + /// <para/> + /// Collection initializer note: To create and populate a <see cref="BooleanQuery"/> + /// in a single statement, you can use the following example as a guide: + /// + /// <code> + /// var booleanQuery = new BooleanQuery() { + /// { new WildcardQuery(new Term("field2", "foobar")), Occur.SHOULD }, + /// { new MultiPhraseQuery() { + /// new Term("field", "microsoft"), + /// new Term("field", "office") + /// }, Occur.SHOULD } + /// }; + /// + /// // or + /// + /// var booleanQuery = new BooleanQuery() { + /// new BooleanClause(new WildcardQuery(new Term("field2", "foobar")), Occur.SHOULD), + /// new BooleanClause(new MultiPhraseQuery() { + /// new Term("field", "microsoft"), + /// new Term("field", "office") + /// }, Occur.SHOULD) + /// }; + /// </code> /// </summary> #if FEATURE_SERIALIZABLE [Serializable]
