• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmrs / openmrs-core / 14868735258

06 May 2025 08:07PM UTC coverage: 64.907% (-0.05%) from 64.957%
14868735258

push

github

web-flow
TRUNK-6301 Add ElasticSearch backend for full text search (#5017)

3 of 29 new or added lines in 3 files covered. (10.34%)

7 existing lines in 5 files now uncovered.

23343 of 35964 relevant lines covered (64.91%)

0.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

7.69
/api/src/main/java/org/openmrs/api/db/hibernate/search/elasticsearch/ElasticsearchConfig.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs.api.db.hibernate.search.elasticsearch;
11

12
import org.hibernate.search.backend.elasticsearch.analysis.ElasticsearchAnalysisConfigurationContext;
13
import org.hibernate.search.backend.elasticsearch.analysis.ElasticsearchAnalysisConfigurer;
14
import org.openmrs.api.db.hibernate.search.SearchAnalysis;
15
import org.springframework.stereotype.Component;
16
import org.springframework.stereotype.Service;
17

18
/**
19
 * Provides Lucene analyzers.
20
 *
21
 * @see SearchAnalysis
22
 * @since 2.8.0
23
 */
24
@Component("elasticsearchConfig")
25
public class ElasticsearchConfig implements ElasticsearchAnalysisConfigurer {
26
        
27
        public ElasticsearchConfig() {
1✔
28
        }
1✔
29

30
        @Override
31
        public void configure(ElasticsearchAnalysisConfigurationContext context) {
NEW
32
                context.analyzer(SearchAnalysis.NAME_ANALYZER).custom()
×
NEW
33
                        .tokenizer("standard")
×
NEW
34
                        .tokenFilters("lowercase", "asciifolding");
×
35

NEW
36
                context.analyzer(SearchAnalysis.PHRASE_ANALYZER).custom()
×
NEW
37
                        .tokenizer("whitespace")
×
NEW
38
                        .tokenFilters("lowercase", "asciifolding");
×
39

NEW
40
                context.analyzer(SearchAnalysis.EXACT_ANALYZER).custom()
×
NEW
41
                        .tokenizer("whitespace")
×
NEW
42
                        .tokenFilters("lowercase", "asciifolding");
×
43

NEW
44
                context.analyzer(SearchAnalysis.START_ANALYZER).custom()
×
NEW
45
                        .tokenizer("whitespace")
×
NEW
46
                        .tokenFilters("lowercase", "asciifolding", "edge_ngram_2_20");
×
47

NEW
48
                context.analyzer(SearchAnalysis.ANYWHERE_ANALYZER).custom()
×
NEW
49
                        .tokenizer("whitespace")
×
NEW
50
                        .tokenFilters("lowercase", "asciifolding", "ngram_2_20");
×
51

NEW
52
                context.analyzer(SearchAnalysis.SOUNDEX_ANALYZER).custom()
×
NEW
53
                        .tokenizer("standard")
×
NEW
54
                        .tokenFilters("lowercase", "asciifolding", "phonetic_soundex");
×
55
                
NEW
56
                context.tokenFilter("edge_ngram_2_20").type("edge_ngram")
×
NEW
57
                        .param("min_gram", "2").param("max_gram", "20");
×
58

NEW
59
                context.tokenFilter("ngram_2_20").type("ngram")
×
NEW
60
                        .param("min_gram", "2").param("max_gram", "20");
×
61
                
NEW
62
                context.tokenFilter("phonetic_soundex").type("phonetic").param("encoder", "soundex");
×
NEW
63
        }
×
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc