From a1151e63fb4dca2fe624ebbaa6777f9f3da78f3e Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 10 Aug 2015 13:52:26 +0200 Subject: [PATCH] [DOCS] updated migrate guide with info for plugins --- .../migration/migrate_query_refactoring.asciidoc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/reference/migration/migrate_query_refactoring.asciidoc b/docs/reference/migration/migrate_query_refactoring.asciidoc index 1f066db141e..8701ec31ed5 100644 --- a/docs/reference/migration/migrate_query_refactoring.asciidoc +++ b/docs/reference/migration/migrate_query_refactoring.asciidoc @@ -4,6 +4,19 @@ This section discusses changes that are breaking to the current rest or java-api on the query-refactoring feature branch. +=== Plugins + +Plugins implementing custom queries need to implement the `fromXContent(QueryParseContext)` method in their +`QueryParser` subclass rather than `parse`. This method will take care of parsing the query from `XContent` format +into an intermediate query representation that can be streamed between the nodes in binary format, effectively the +query object used in the java api. Also, the query parser needs to implement the `getBuilderPrototype` method that +returns a prototype of the streamable query, which allows to deserialize an incoming query by calling +`readFrom(StreamInput)` against it, which will create a new object, see usages of `Writeable`. +The query object can then transform itself into a lucene query through the new `toQuery(QueryShardContext)` method, +which returns a lucene query to be executed on the data node. The query implementation also needs to implement the +`validate` method that allows to validate the content of the query, no matter whether it came in through the java api +directly or through the REST layer. + === Java-API ==== BoostingQueryBuilder @@ -32,7 +45,6 @@ Updated the static factory methods in QueryBuilders and tests accordingly. Removed setters for mandatory big/little inner span queries. Both arguments now have to be supplied at construction time already and have to be non-null. Updated static factory methods in QueryBuilders accordingly. ->>>>>>> Query refactoring: SpanWithinQueryBuilder and Parser ==== QueryFilterBuilder @@ -52,4 +64,4 @@ codebase and avoid duplication. Support for `queryName` and `boost` has been streamlined to all of the queries. That is a breaking change till queries get sent over the network as serialized json rather than in `Streamable` format. In fact whenever additional fields are added to the json -representation of the query, older nodes might throw error when they find unknown fields.pd +representation of the query, older nodes might throw error when they find unknown fields.