Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the percolator from core to its own module #18511

Merged
merged 1 commit into from
May 24, 2016

Conversation

martijnvg
Copy link
Member

The most significant changes I had to make was moving AbstractQueryTestCase to the test framework module and add support the register custom plugins. Moving this base test class to the test framework was required because the percolate query is the first query outside of the core module and its unit test PercolateQueryBuilderTests extends from this test base class. The AbstractQueryTestCase didn't have support the register queries outside of core, so added support to the AbstractQueryTestCase class to register a plugin which then register its custom queries if the plugin contains that. I'm not super happy with the way needed to expose this, the entire initialization happens in a static method, so tests that want to test custom query builders now need to have a static initializer that registers a plugin. If someone has a simpler/cleaner solution for this then that would be great.

Other changes:

  • Lift the restriction that only one percolator could be added per index. This validation existed in MapperService, but because the percolator moved to a module it could no longer exist there. Instead of bringing it back it was removed. This validation existed since the percolator cache only supported one percolator query per document, since the percolator cache has been removed this restriction could removed as well.
  • While moving percolator tests to the new module, also removed a couple of tests for the deprecated percolate and mpercolate api. These APIs are now sugar APIs for bwc support and redirect to the search and msearch APIs. Some tests were still testing as if percolate and mpercolate API did the percolation, but this no longer the case and these tests could be removed.

Note: The breaking part is that the percolate methods have been removed from the Client class in the Java api.

@martijnvg martijnvg added >enhancement >breaking review :Search Relevance/Percolator Reverse search: find queries that match a document labels May 22, 2016
pluginsService.processModules(modulesBuilder);
injector = modulesBuilder.createInjector();
IndexScopedSettings indexScopedSettings = injector.getInstance(IndexScopedSettings.class);
idxSettings = IndexSettingsModule.newIndexSettings(index, indexSettings, indexScopedSettings);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this moved down here and why do you need to Initialize idxSettings so late?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need it after the guice injector has been created, so that I can get IndexScopedSettings instance. The percolator query builder test that tests the doToQuery would otherwise fail, since there an index setting is checked that the PercolatorPlugin registers.

@martijnvg martijnvg changed the title Moved the percolator from core to its own module Move the percolator from core to its own module May 23, 2016
SearchContext.removeCurrent();
}

protected final QB createTestQueryBuilder() {
static class Holder {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't come up with a better name...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ServiceHolder?

@martijnvg
Copy link
Member Author

@s1monw @cbuescher I've changed the initialization method to be a member method and introduced this the Holder clause that gets initialized only once per test suite.

@@ -420,36 +414,6 @@
MultiTermVectorsRequestBuilder prepareMultiTermVectors();

/**
* Percolates a request returning the matches documents.
*/
ActionFuture<PercolateResponse> percolate(PercolateRequest request);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that has come up with reindex being in a plugin: users of the Java API have trouble finding it. I don't know what, if anything, we should do about that. This will have the same problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is true. The docs that described how to integrate with percolate api via the Java client have been replaced with: https://www.elastic.co/guide/en/elasticsearch/client/java-api/master/java-specialized-queries.html#java-query-percolate-query

I'll bring back the percolator java api docs with a description on how to access the api now that the percolator api has been removed from the Client interface. Otherwise people that wish to use the percolator api a bit longer are in the dark before cutting over to the search api.

@s1monw
Copy link
Contributor

s1monw commented May 23, 2016

left some minors LGTM otherwise 👍

Significant changes:
* AbstractQueryTestCase has moved to the test framework module, in order for query builder tests in modules and plugins
* Added support to AbstractQueryTestCase to register plugins
* Lift the restriction that only one percolator could be added per index. This validation existed in MapperService, but because the percolator moved to a module it could no longer exist there. Instead of bringing it back it was removed. This validation existed since the percolator cache only supported one percolator query per document, since the percolator cache has been removed this restriction could removed as well.
* While moving percolator tests to the new module, also removed a couple of tests for the deprecated percolate and mpercolate api. These APIs are now sugar  APIs for bwc and rediect to the searvh and msearvh APIs. Some tests were still testing as if percolate and mpercolate API did the percolation, but this no longer the case and these tests could be removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants