mikemccand commented on a change in pull request #638: LUCENE-8756: Fix MLT
like text with custom frequencies
URL: https://github.com/apache/lucene-solr/pull/638#discussion_r279686118
##########
File path:
lucene/queries/src/test/org/apache/lucene/queries/mlt/TestMoreLikeThis.java
##########
@@ -427,5 +438,70 @@ public void
testMultiFieldShouldReturnPerFieldBooleanQuery() throws Exception {
analyzer.close();
}
}
+
+ public void testCustomFrequecy() throws IOException {
+ // define an analyzer with delimited term frequency, e.g. "foo|2 bar|3"
+ Analyzer analyzer = new Analyzer() {
+
+ @Override
+ protected TokenStreamComponents createComponents(String fieldName) {
+ MockTokenizer tokenizer = new MockTokenizer(MockTokenizer.WHITESPACE,
false, 100);
+ MockTokenFilter filt = new MockTokenFilter(tokenizer,
MockTokenFilter.EMPTY_STOPSET);
+ return new TokenStreamComponents(tokenizer, foo(filt));
+ }
+
+ TokenStream foo(TokenStream input) {
Review comment:
Maybe give this method a better name? Maybe `addCustomTokenFilter` or
something?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]