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/10/13 11:10:04 UTC
[07/10] lucenenet git commit: Lucene.Net.ICU: Added extension methods
to Document class for adding ICU-related Field types
Lucene.Net.ICU: Added extension methods to Document class for adding ICU-related Field types
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ecf3e4e0
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ecf3e4e0
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ecf3e4e0
Branch: refs/heads/master
Commit: ecf3e4e09a82f2457a29ea7579024c85a402e184
Parents: a032177
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Oct 5 03:46:55 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Oct 5 03:49:38 2017 +0700
----------------------------------------------------------------------
.../Support/Document/DocumentExtensions.cs | 46 ++++++++++++++++++++
1 file changed, 46 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ecf3e4e0/src/dotnet/Lucene.Net.ICU/Support/Document/DocumentExtensions.cs
----------------------------------------------------------------------
diff --git a/src/dotnet/Lucene.Net.ICU/Support/Document/DocumentExtensions.cs b/src/dotnet/Lucene.Net.ICU/Support/Document/DocumentExtensions.cs
new file mode 100644
index 0000000..1ea38e5
--- /dev/null
+++ b/src/dotnet/Lucene.Net.ICU/Support/Document/DocumentExtensions.cs
@@ -0,0 +1,46 @@
+using Icu.Collation;
+using Lucene.Net.Collation;
+
+namespace Lucene.Net.Documents
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// <summary>
+ /// LUCENENET specific extensions to the <see cref="Document"/> class.
+ /// </summary>
+ public static class DocumentExtensions
+ {
+ /// <summary>
+ /// Adds a new <see cref="ICUCollationDocValuesField"/>.
+ /// <para/>
+ /// NOTE: you should not create a new one for each document, instead
+ /// just make one and reuse it during your indexing process, setting
+ /// the value via <see cref="ICUCollationDocValuesField.SetStringValue(string)"/>.
+ /// </summary>
+ /// <param name="document">This <see cref="Document"/>.</param>
+ /// <param name="name">Field name.</param>
+ /// <param name="collator">Collator for generating collation keys.</param>
+ /// <returns>The field that was added to this <see cref="Document"/>.</returns>
+ public static ICUCollationDocValuesField AddICUCollationDocValuesField(this Document document, string name, Collator collator)
+ {
+ var field = new ICUCollationDocValuesField(name, collator);
+ document.Add(field);
+ return field;
+ }
+ }
+}