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.index.server.analysis; 018 019import com.echothree.model.control.index.common.IndexFields; 020import com.echothree.model.data.core.server.entity.EntityAliasType; 021import com.echothree.model.data.core.server.entity.EntityAttribute; 022import com.echothree.model.data.core.server.entity.EntityType; 023import com.echothree.model.data.party.server.entity.Language; 024import com.echothree.model.data.tag.server.entity.TagScope; 025import com.echothree.util.server.message.ExecutionErrorAccumulator; 026import java.util.List; 027import java.util.Map; 028import org.apache.lucene.analysis.Analyzer; 029 030public class ContactMechanismAnalyzer 031 extends BasicAnalyzer { 032 033 public ContactMechanismAnalyzer(final ExecutionErrorAccumulator eea, final Language language, final EntityType entityType, final List<EntityAliasType> entityAliasTypes, final List<EntityAttribute> entityAttributes, 034 final List<TagScope> tagScopes) { 035 super(eea, language, entityType, entityAliasTypes, entityAttributes, tagScopes); 036 } 037 038 public ContactMechanismAnalyzer(final ExecutionErrorAccumulator eea, final Language language, final EntityType entityType) { 039 super(eea, language, entityType); 040 } 041 042 @Override 043 protected Map<String, Analyzer> getEntityTypeAnalyzers(final Map<String, Analyzer> fieldAnalyzers) { 044 super.getEntityTypeAnalyzers(fieldAnalyzers); 045 046 fieldAnalyzers.put(IndexFields.contactMechanismName.name(), new WhitespaceLowerCaseAnalyzer()); 047 fieldAnalyzers.put(IndexFields.contactMechanismTypeName.name(), new WhitespaceLowerCaseAnalyzer()); 048 fieldAnalyzers.put(IndexFields.allowSolicitation.name(), new WhitespaceLowerCaseAnalyzer()); 049 fieldAnalyzers.put(IndexFields.contactMechanismPurposeNames.name(), new WhitespaceLowerCaseAnalyzer()); 050 fieldAnalyzers.put(IndexFields.emailAddress.name(), new WhitespaceLowerCaseAnalyzer()); 051 fieldAnalyzers.put(IndexFields.inet4Address.name(), new WhitespaceLowerCaseAnalyzer()); 052 fieldAnalyzers.put(IndexFields.url.name(), new WhitespaceLowerCaseAnalyzer()); 053 fieldAnalyzers.put(IndexFields.countryGeoCodeName.name(), new WhitespaceLowerCaseAnalyzer()); 054 fieldAnalyzers.put(IndexFields.areaCode.name(), new WhitespaceLowerCaseAnalyzer()); 055 fieldAnalyzers.put(IndexFields.telephoneNumber.name(), new WhitespaceLowerCaseAnalyzer()); 056 fieldAnalyzers.put(IndexFields.telephoneExtension.name(), new WhitespaceLowerCaseAnalyzer()); 057 fieldAnalyzers.put(IndexFields.cityGeoCodeName.name(), new WhitespaceLowerCaseAnalyzer()); 058 fieldAnalyzers.put(IndexFields.countyGeoCodeName.name(), new WhitespaceLowerCaseAnalyzer()); 059 fieldAnalyzers.put(IndexFields.stateGeoCodeName.name(), new WhitespaceLowerCaseAnalyzer()); 060 fieldAnalyzers.put(IndexFields.postalCodeGeoCodeName.name(), new WhitespaceLowerCaseAnalyzer()); 061 fieldAnalyzers.put(IndexFields.isCommercial.name(), new WhitespaceLowerCaseAnalyzer()); 062 063 return fieldAnalyzers; 064 } 065 066}