Skip to content

Commit 2f341a8

Browse files
yrodiereSanne
authored andcommitted
HSEARCH-2219 Remove most of the custom analyzer definitions from elasticsearch.yml
They are not needed anymore, since we push those definitions automatically.
1 parent 17510cd commit 2f341a8

File tree

2 files changed

+9
-68
lines changed

2 files changed

+9
-68
lines changed

elasticsearch/elasticsearchconfiguration/elasticsearch.yml

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -53,75 +53,14 @@ index.number_of_replicas: 0
5353
script.engine.groovy.inline.search: on
5454

5555
# Custom analyzer used in tests
56+
# See ElasticsearchAnalyzerIT
5657
index.analysis:
5758
analyzer:
58-
custom-analyzer:
59+
server-defined-custom-analyzer:
5960
type: custom
6061
tokenizer: standard
61-
filter: [custom-filter, lowercase]
62-
stemmer:
63-
type: custom
64-
tokenizer: standard
65-
filter: [lowercase, stopWordsDefaultEnglish, snowballEnglish]
66-
ngram:
67-
type: custom
68-
tokenizer: standard
69-
filter: [lowercase, stopWordsDefaultEnglish, ngram3]
70-
htmlStrip:
71-
type: custom
72-
tokenizer: standard
73-
filter: [lowercase]
74-
char_filter: htmlStrip
75-
org_hibernate_search_test_configuration_BlogEntry_en:
76-
type: custom
77-
tokenizer: standard
78-
filter: [lowercase, snowballEnglish]
79-
org_hibernate_search_test_configuration_BlogEntry_de:
80-
type: custom
81-
tokenizer: standard
82-
filter: [lowercase, stemGerman]
83-
org_hibernate_search_test_configuration_ProgrammaticSearchMappingFactory_ngram:
84-
type: custom
85-
tokenizer: standard
86-
filter: [lowercase, ngram3]
87-
org_hibernate_search_test_configuration_ProgrammaticSearchMappingFactory_english:
88-
type: custom
89-
tokenizer: standard
90-
filter: [lowercase, snowballEnglish]
91-
org_hibernate_search_test_configuration_ProgrammaticSearchMappingFactory_deutsch:
92-
type: custom
93-
tokenizer: standard
94-
filter: [lowercase, stemGerman]
95-
org_hibernate_search_test_query_facet_Car_collatingAnalyzer:
96-
type: custom
97-
tokenizer: keyword
98-
filter: [asciifolding, lowercase]
99-
org_hibernate_search_test_sorting_SortingTest_Person_collatingAnalyzer:
100-
type: custom
101-
tokenizer: keyword
102-
filter: [asciifolding, lowercase]
103-
org_hibernate_search_test_sorting_SortingTest_Person_tokenizingAnalyzer:
104-
type: custom
105-
tokenizer: whitespace
62+
filter: [server-defined-custom-filter, lowercase]
10663
filter:
107-
custom-filter:
64+
server-defined-custom-filter:
10865
type : stop
10966
stopwords : [test1, close]
110-
stopWordsDefaultEnglish:
111-
type: stop
112-
# default list of stop words. See org.apache.lucene.analysis.core.StopAnalyzer#ENGLISH_STOP_WORDS_SET
113-
stopwords: [a, an, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, such, that, the, their, then, there, these, they, this, to, was, will, with]
114-
ngram3:
115-
type : nGram
116-
min_gram: 3
117-
max_gram: 3
118-
snowballEnglish:
119-
type: snowball
120-
language: 'English'
121-
stemGerman:
122-
type : stemmer
123-
name : 'german'
124-
char_filter:
125-
htmlStrip:
126-
type: html_strip
127-
escaped_tags: [escaped]

elasticsearch/src/test/java/org/hibernate/search/elasticsearch/test/ElasticsearchAnalyzerIT.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.hibernate.search.Search;
2323
import org.hibernate.search.annotations.Analyze;
2424
import org.hibernate.search.annotations.Analyzer;
25+
import org.hibernate.search.annotations.AnalyzerDef;
2526
import org.hibernate.search.annotations.Field;
2627
import org.hibernate.search.annotations.Fields;
2728
import org.hibernate.search.annotations.Indexed;
@@ -30,7 +31,8 @@
3031
import org.junit.Test;
3132

3233
/**
33-
* Test the use of Elasticsearch built-in and custom analyzers.
34+
* Test the use of Elasticsearch built-in and server-defined, custom analyzers,
35+
* <strong>without</strong> using {@link AnalyzerDef}.
3436
*
3537
* @author Davide D'Alto
3638
*/
@@ -161,12 +163,12 @@ public static class Tweet {
161163

162164
@Field
163165
// Defined in the elasticsearch.yml configuration file
164-
@Analyzer(definition = "custom-analyzer")
166+
@Analyzer(definition = "server-defined-custom-analyzer")
165167
private String customTweet;
166168

167169
@Fields({
168170
@Field(name = "tweetNotAnalyzed", analyze = Analyze.NO, store = Store.YES),
169-
@Field(name = "tweetWithCustom", analyzer = @Analyzer(definition = "custom-analyzer") ) })
171+
@Field(name = "tweetWithCustom", analyzer = @Analyzer(definition = "server-defined-custom-analyzer") ) })
170172
private String multipleTweets;
171173

172174
private String defaultAnalyzer;

0 commit comments

Comments
 (0)