Interface DocumentElement

  • All Known Implementing Classes:
    NoOpDocumentElement

    public interface DocumentElement
    An element of a document.

    Instances may represent the document root as well as a partial view of the document, for instance a view on a specific "object" field nested inside the document.

    • Method Detail

      • addValue

        <F> void addValue​(IndexFieldReference<F> fieldReference,
                          F value)
        Add a new value to a field in this document element.

        This method can be called multiple times for the same field, which will result in multiple values being added to the same field.

        Type Parameters:
        F - The type of values for the given field.
        Parameters:
        fieldReference - A reference to the field to add a value to. References are returned by IndexSchemaFieldFinalStep.toReference() in the field definition DSL.
        value - The value to add to the field.
        Throws:
        SearchException - If the field is defined in a different document element.
      • addNullObject

        void addNullObject​(IndexObjectFieldReference fieldReference)
        Add a null object to the referenced field in this document element.

        The null object may have a representation in the backend (such as a JSON null), or it may be ignored completely, depending on the backend implementation.

        Parameters:
        fieldReference - A reference to the object field to add a null object to. References are returned by IndexSchemaFieldFinalStep.toReference() in the field definition DSL.
        Throws:
        SearchException - If the field is defined in a different document element.
      • addValue

        void addValue​(String relativeFieldName,
                      Object value)
        Add a new value to a field in this document element.

        This method can be called multiple times for the same field, which will result in multiple values being added to the same field.

        Parameters:
        relativeFieldName - The name of the field to add a value to, relative to this document element. The field must have been defined previously, either directly through IndexSchemaElement.field(String, Function), or indirectly through IndexSchemaElement.fieldTemplate(String, Function).
        value - The value to add to the field.
        Throws:
        SearchException - If the field is not defined or if value has an incorrect type of this field.