Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void removeFromExactIndexedDocumentRetainCorrectNumberOfFields()
        public virtual void RemoveFromExactIndexedDocumentRetainCorrectNumberOfFields()
        {
            Document document = new Document();

            IndexType.addToDocument(document, STRING_TEST_FIELD, "value");
            IndexType.addToDocument(document, STRING_TEST_FIELD2, "value2");
            IndexType.addToDocument(document, NUMERIC_TEST_FIELD, 1);
            IndexType.addToDocument(document, NUMERIC_TEST_FIELD2, 2);
            IndexType.removeFromDocument(document, STRING_TEST_FIELD, null);
            assertEquals("Usual fields, doc values fields for user fields and housekeeping fields.", DocumentFieldsPerUserField * 3, document.Fields.size());
            assertEquals("Two string fields with specified name expected.", 2, GetDocumentFields(document, STRING_TEST_FIELD2).Length);
            assertEquals("Two numeric fields with specified name expected.", 2, GetDocumentFields(document, NUMERIC_TEST_FIELD).Length);
            assertEquals("Two numeric fields with specified name expected.", 2, GetDocumentFields(document, NUMERIC_TEST_FIELD2).Length);
        }
Ejemplo n.º 2
0
 private void AddSingleProperty(long entityId, Document document, string key, object value)
 {
     foreach (object oneValue in IoPrimitiveUtils.asArray(value))
     {
         bool isValueContext = oneValue is ValueContext;
         oneValue = isValueContext ? (( ValueContext )oneValue).CorrectValue : oneValue.ToString();
         _type.addToDocument(document, key, oneValue);
         if (_createdNow)
         {
             // If we know that the index was created this session
             // then we can go ahead and add stuff to the cache directly
             // when adding to the index.
             AddToCache(entityId, key, oneValue);
         }
     }
 }