示例#1
0
        public void CreateDateTimeKeywordField()
        {
            FieldAdapter keyword = FieldAdapter.CreateKeywordField("Name", DateTime.Now);

            Assert.AreEqual("Name", keyword.Name);

            Assert.IsFalse(keyword.IsTokenized);
            Assert.IsTrue(keyword.IsIndexed);
            Assert.IsTrue(keyword.IsStored);
        }
示例#2
0
        public void CreateUnstoredField()
        {
            FieldAdapter unstored = FieldAdapter.CreateUnstoredField("Name", "Value");

            Assert.AreEqual("Name", unstored.Name);
            Assert.AreEqual("Value", unstored.StringValue);

            Assert.IsTrue(unstored.IsTokenized);
            Assert.IsTrue(unstored.IsIndexed);
            Assert.IsFalse(unstored.IsStored);
        }
示例#3
0
        public void CreateTextField()
        {
            FieldAdapter text = FieldAdapter.CreateTextField("Name", "Value");

            Assert.AreEqual("Name", text.Name);
            Assert.AreEqual("Value", text.StringValue);

            Assert.IsTrue(text.IsTokenized);
            Assert.IsTrue(text.IsIndexed);
            Assert.IsTrue(text.IsStored);
        }
示例#4
0
        public void CreateKeywordField()
        {
            FieldAdapter keyword = FieldAdapter.CreateKeywordField("Name", "Value");

            Assert.AreEqual("Name", keyword.Name);
            Assert.AreEqual("Value", keyword.StringValue);

            Assert.IsFalse(keyword.IsTokenized);
            Assert.IsTrue(keyword.IsIndexed);
            Assert.IsTrue(keyword.IsStored);
        }
示例#5
0
        public void Boost()
        {
            Field        field        = Field.Keyword("Name", "Value");
            FieldAdapter fieldAdapter = new FieldAdapter(field);

            Assert.AreEqual(field.GetBoost(), fieldAdapter.Boost);

            fieldAdapter.Boost = 0.7f;
            Assert.AreEqual(0.7f, fieldAdapter.Boost);
            Assert.AreEqual(field.GetBoost(), fieldAdapter.Boost);
        }
示例#6
0
        public void CreateReaderTextField()
        {
            TextReader textReader = new StringReader(string.Empty);

            FieldAdapter text = FieldAdapter.CreateTextField("Name", textReader);

            Assert.AreEqual("Name", text.Name);
            Assert.AreSame(textReader, text.ReaderValue);

            Assert.IsTrue(text.IsTokenized);
            Assert.IsTrue(text.IsIndexed);
            Assert.IsFalse(text.IsStored);
        }
 public void Add <T>(string fieldType, FieldAdapter <T> adapter)
     where T : class
 {
     Add(fieldType, adapter);
 }