Class XContentStructure

  • Direct Known Subclasses:
    XContentStructure.InnerFilter, XContentStructure.InnerQuery


    public abstract class XContentStructure
    extends Object
    XContentStructure is a class used to capture a subset of query, to be parsed at a later time when more information (in this case, types) is available. Note that using this class requires copying the parser's data, which will result in additional overhead versus parsing the inner query/filter immediately, however, the extra overhead means that the type not be extracted prior to query parsing (in the case of unordered JSON).
    • Nested Class Summary

      Nested Classes

      Modifier and Type Class and Description
      static class  XContentStructure.InnerFilter
      InnerFilter is an extension of XContentStructure that eagerly parses the filter in a streaming manner if the types are available at construction time.
      static class  XContentStructure.InnerQuery
      InnerQuery is an extension of XContentStructure that eagerly parses the query in a streaming manner if the types are available at construction time.
    • Constructor Summary

      Constructors

      Constructor and Description
      XContentStructure(QueryParseContext queryParseContext)
      Create a new XContentStructure for the current parsing context.
    • Constructor Detail

      • XContentStructure

        public XContentStructure(QueryParseContext queryParseContext)
        Create a new XContentStructure for the current parsing context.
    • Method Detail

      • bytes

        public void bytes(BytesReference innerBytes)
        Set the bytes to be used for parsing
      • bytes

        public BytesReference bytes()
        Return the bytes that are going to be used for parsing
      • asQuery

        public org.apache.lucene.search.Query asQuery(String... types)
                                               throws IOException
        Use the captured bytes to parse the inner query using the specified types. The original QueryParseContext's parser is switched during this parsing, so this method is NOT thread-safe.
        Parameters:
        types - types to be used during the inner query parsing
        Returns:
        Query parsed from the bytes captured in freeze()
        Throws:
        IOException
      • asFilter

        public org.apache.lucene.search.Query asFilter(String... types)
                                                throws IOException
        Use the captured bytes to parse the inner filter using the specified types. The original QueryParseContext's parser is switched during this parsing, so this method is NOT thread-safe.
        Parameters:
        types - types to be used during the inner filter parsing
        Returns:
        XConstantScoreQuery wrapping the filter parsed from the bytes captured in freeze()
        Throws:
        IOException