001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016
017package com.echothree.model.control.customer.server.analysis;
018
019import com.echothree.model.control.index.common.IndexFields;
020import com.echothree.model.control.index.server.analysis.PartyAnalyzer;
021import com.echothree.model.control.index.server.analysis.WhitespaceLowerCaseAnalyzer;
022import com.echothree.model.data.core.server.entity.EntityAliasType;
023import com.echothree.model.data.core.server.entity.EntityAttribute;
024import com.echothree.model.data.core.server.entity.EntityType;
025import com.echothree.model.data.party.server.entity.Language;
026import com.echothree.model.data.party.server.entity.PartyType;
027import com.echothree.model.data.tag.server.entity.TagScope;
028import com.echothree.util.server.message.ExecutionErrorAccumulator;
029import java.util.List;
030import java.util.Map;
031import org.apache.lucene.analysis.Analyzer;
032
033public class CustomerAnalyzer
034        extends PartyAnalyzer {
035
036    public CustomerAnalyzer(final ExecutionErrorAccumulator eea, final Language language, final EntityType entityType, final List<EntityAliasType> entityAliasTypes, final List<EntityAttribute> entityAttributes,
037            final List<TagScope> tagScopes, final PartyType partyType,
038            final String entityNameIndexField) {
039        super(eea, language, entityType, entityAliasTypes, entityAttributes, tagScopes, partyType, entityNameIndexField);
040    }
041
042    public CustomerAnalyzer(final ExecutionErrorAccumulator eea, final Language language, final EntityType entityType,
043            final PartyType partyType, final String entityNameIndexField) {
044        super(eea, language, entityType, partyType, entityNameIndexField);
045    }
046
047    @Override
048    protected Map<String, Analyzer> getAdditionalAnalyzers(final Map<String, Analyzer> fieldAnalyzers) {
049        fieldAnalyzers.put(IndexFields.customerTypeName.name(), new WhitespaceLowerCaseAnalyzer());
050
051        return fieldAnalyzers;
052    }
053
054}