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

Drop name from all analysis component factories #24976

Closed

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented May 30, 2017

A continuation of #24869, this drops the name() method from
all remaining analysis component factories, moving name members
to CustomAnalayzer in service of the _analyze action.

Like #24869 I've kept a String in the method signature of the
ctor of some abstract components so that back these analysis
component factories. It is much more convenient to remove all
the names at once in a followup. That change will be large but
purely mechanical.

A continuation of elastic#24869, this drops the `name()` method from
all remaining analysis component factories, moving name members
to `CustomAnalayzer` in service of the `_analyze` action.

Like elastic#24869 I've kept a `String` in the method signature of the
ctor of some abstract components so that back these analysis
component factories. It is *much* more convenient to remove all
the names at once in a followup. That change will be large but
purely mechanical.

This breaks the API for plugins adding analyzers because they
no longer must implement fairly redundant feeline method.
@nik9000 nik9000 added :Core/Infra/Plugins Plugin API and infrastructure >breaking-java v6.0.0 labels May 30, 2017
@@ -462,96 +466,106 @@ private void analyze(TokenStream stream, Analyzer analyzer, String field, Set<St
return extendedAttributes;
}

private static CharFilterFactory[] getCharFilterFactories(AnalyzeRequest request, IndexSettings indexSettings, AnalysisRegistry analysisRegistry,
Environment environment, CharFilterFactory[] charFilterFactories) throws IOException {
if (request.charFilters() != null && request.charFilters().size() > 0) {
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've switched this around to return early rather than indent a bunch so the change look bigger than it is.

Copy link
Member Author

Choose a reason for hiding this comment

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

The functionality change here is to return a Tuple with the names as well.

@@ -63,10 +69,24 @@ public TokenizerFactory tokenizerFactory() {
return tokenizerFactory;
}

/**
* Names of the token filters.
Copy link
Member Author

Choose a reason for hiding this comment

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

These are needed by the analysis API but not really anywhere else. They aren't a huge burden to maintain though, not like the name() member was.


private interface MultiTermAwareTokenFilterFactory extends TokenFilterFactory, MultiTermAwareComponent {}

public synchronized TokenFilterFactory getTokenFilterFactory(final Version version) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just not needed any more.

@nik9000 nik9000 requested a review from rjernst May 30, 2017 23:02
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@dakrone
Copy link
Member

dakrone commented Aug 15, 2017

@nik9000 this PR is approved, I think it just needs to have master merged and then be merged right?

@nik9000 nik9000 added v7.0.0 and removed v6.0.0 labels Aug 15, 2017
@nik9000
Copy link
Member Author

nik9000 commented Aug 15, 2017

@nik9000 this PR is approved, I think it just needs to have master merged and then be merged right?

I'd literally forgotten about it. I'll have a look.

@dakrone
Copy link
Member

dakrone commented Aug 15, 2017

Thanks!

@nik9000
Copy link
Member Author

nik9000 commented Aug 17, 2017

@martijnvg I just merged master into this. It is fairly similar to how it used to be but I think it is worth another look just in case. Could you look again please?

@nik9000
Copy link
Member Author

nik9000 commented Oct 10, 2017

@martijnvg can you give this another look? The merge changed it a lot after your last review.

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

@nik9000 Still LGTM! Can we backport this to 6.x branch too? This only is breaking for plugins?

@rjernst
Copy link
Member

rjernst commented Mar 11, 2018

@nik9000 Is this something you would still like to get in?

@nik9000
Copy link
Member Author

nik9000 commented Mar 12, 2018

@nik9000 Is this something you would still like to get in?

Yes! Oh boy, all out of date again....

I'll take a look soon.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -29,14 +29,10 @@ public PreBuiltAnalyzerProvider(String name, AnalyzerScope scope, Analyzer analy
// we create the named analyzer here so the resources associated with it will be shared
// and we won't wrap a shared analyzer with named analyzer each time causing the resources
// to not be shared...
// TODO why not pass a NamedAnalyzer into the method?
Copy link
Member

Choose a reason for hiding this comment

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

What is this comment for? It is unclear what it refers to.

@@ -24,8 +24,6 @@
import org.elasticsearch.search.fetch.subphase.highlight.FastVectorHighlighter;

public interface TokenFilterFactory {
Copy link
Member

Choose a reason for hiding this comment

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

Can this be made a FunctionalInterface now?

@nik9000
Copy link
Member Author

nik9000 commented Mar 19, 2018

Update: I do still plan to merge this but it currently doesn't build cleanly. I've got to get into the right head space to get it properly working again because it is all around code I haven't read in a while. I'll get it though!

@s1monw
Copy link
Contributor

s1monw commented Nov 15, 2018

@nik9000 still wanna merge this?

@nik9000
Copy link
Member Author

nik9000 commented Nov 16, 2018

At this point I'm not sure I could get it merge-able. It has been too long.

@nik9000 nik9000 closed this Nov 16, 2018
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
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.

6 participants