コード例 #1
0
        /// <summary>
        /// Adds a new <see cref="SingleAssociationFacetField"/> using <paramref name="dim"/> and <paramref name="path"/> and a
        /// <see cref="float"/> association.
        /// </summary>
        /// <param name="document">This <see cref="Document"/>.</param>
        /// <param name="assoc">Associated value.</param>
        /// <param name="dim">Dimension for this field.</param>
        /// <param name="path">Facet path for this field.</param>
        /// <returns>The field that was added to this <see cref="Document"/>.</returns>
        public static SingleAssociationFacetField AddSingleAssociationFacetField(this Document document, float assoc, string dim, params string[] path)
        {
            var field = new SingleAssociationFacetField(assoc, dim, path);

            document.Add(field);
            return(field);
        }
コード例 #2
0
        public void TestAddSingleAssociationFacetField()
        {
            SingleAssociationFacetField field = null;
            float assoc = 1234.5678f;

            string[] path = new[] { "thePath0", "thePath1", "thePath2" };
            AssertDocumentExtensionAddsToDocument(document => field = document.AddSingleAssociationFacetField(assoc, "theDim", path));
            Assert.AreEqual(SingleAssociationFacetField.SingleToBytesRef(assoc), field.Assoc);
            Assert.AreEqual("theDim", field.Dim);
            Assert.AreEqual(path, field.Path);
        }
コード例 #3
0
ファイル: DocumentExtensions.cs プロジェクト: ywscr/lucenenet
        /// <summary>
        /// Adds a new <see cref="SingleAssociationFacetField"/> using <paramref name="dim"/> and <paramref name="path"/> and a
        /// <see cref="float"/> association.
        /// </summary>
        /// <param name="document">This <see cref="Document"/>.</param>
        /// <param name="assoc">Associated value.</param>
        /// <param name="dim">Dimension for this field.</param>
        /// <param name="path">Facet path for this field.</param>
        /// <returns>The field that was added to this <see cref="Document"/>.</returns>
        /// <exception cref="ArgumentNullException">This <paramref name="document"/> is <c>null</c>. </exception>
        public static SingleAssociationFacetField AddSingleAssociationFacetField(this Document document, float assoc, string dim, params string[] path)
        {
            if (document is null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            var field = new SingleAssociationFacetField(assoc, dim, path);

            document.Add(field);
            return(field);
        }