// Path: src/main/java/org/codelibs/fess/suggest/constants/FieldNames.java
// public final class FieldNames {
//     public static final String ID = "_id";
//     public static final String TEXT = "text";
//     public static final String READING_PREFIX = "reading_";
//     public static final String SCORE = "score";
//     public static final String QUERY_FREQ = "queryFreq";
//     public static final String DOC_FREQ = "docFreq";
//     public static final String USER_BOOST = "userBoost";
//     public static final String KINDS = "kinds";
//     public static final String TIMESTAMP = "@timestamp";
//     public static final String TAGS = "tags";
//     public static final String ROLES = "roles";
//     public static final String FIELDS = "fields";
//     public static final String LANGUAGES = "languages";
// 
//     public static final String ARRAY_KEY = "key";
//     public static final String ARRAY_VALUE = "value";
// 
//     public static final String ANALYZER_SETTINGS_TYPE = "settingsType";
//     public static final String ANALYZER_SETTINGS_FIELD_NAME = "fieldName";
//     public static final String ANALYZER_SETTINGS_READING_ANALYZER = "readingAnalyzer";
//     public static final String ANALYZER_SETTINGS_READING_TERM_ANALYZER = "readingTermAnalyzer";
//     public static final String ANALYZER_SETTINGS_NORMALIZE_ANALYZER = "normalizeAnalyzer";
//     public static final String ANALYZER_SETTINGS_CONTENTS_ANALYZER = "contentsAnalyzer";
//     public static final String ANALYZER_SETTINGS_CONTENTS_READING_ANALYZER = "contentsReadingAnalyzer";
// 
//     private FieldNames() {
//     }
// }
// 
// Path: src/main/java/org/codelibs/fess/suggest/entity/ElevateWord.java
// public class ElevateWord {
// 
//     protected final String elevateWord;
//     protected final float boost;
//     protected final List<String> readings;
//     protected final List<String> fields;
//     protected final List<String> tags;
//     protected final List<String> roles;
// 
//     public ElevateWord(final String elevateWord, final float boost, final List<String> readings, final List<String> fields,
//             final List<String> tags, final List<String> roles) {
//         this.elevateWord = elevateWord;
//         this.boost = boost;
//         this.readings = readings;
//         this.fields = fields;
//         if (tags == null) {
//             this.tags = Collections.emptyList();
//         } else {
//             this.tags = tags;
//         }
//         if (roles == null) {
//             this.roles = Collections.emptyList();
//         } else {
//             this.roles = roles;
//         }
//     }
// 
//     public String getElevateWord() {
//         return elevateWord;
//     }
// 
//     public float getBoost() {
//         return boost;
//     }
// 
//     public List<String> getReadings() {
//         return readings;
//     }
// 
//     public List<String> getFields() {
//         return fields;
//     }
// 
//     public List<String> getTags() {
//         return tags;
//     }
// 
//     public List<String> getRoles() {
//         return roles;
//     }
// 
//     public SuggestItem toSuggestItem() {
//         final String[][] readingArray =
//                 this.getReadings().stream().map(reading -> new String[] { reading }).toArray(count -> new String[count][]);
//         return new SuggestItem(new String[] { this.getElevateWord() }, readingArray, fields.toArray(new String[fields.size()]), 1, 0,
//                 this.getBoost(), this.getTags().toArray(new String[this.getTags().size()]),
//                 this.getRoles().toArray(new String[this.getRoles().size()]), null, SuggestItem.Kind.USER);
//     }
// }


import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.codelibs.fess.suggest.constants.FieldNames;
import org.codelibs.fess.suggest.entity.ElevateWord;
import org.opensearch.client.Client;
/*
 * Copyright 2012-2022 CodeLibs Project and the Others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package org.codelibs.fess.suggest.settings;



public class ElevateWordSettings {
    private static final Logger logger = Logger.getLogger(ElevateWordSettings.class.getName());

    public static final String ELEVATE_WORD_SETTINGD_KEY = "elevateword";
    public static final String ELEVATE_WORD_BOOST = "boost";
    public static final String ELEVATE_WORD_READING = "reading";
    public static final String ELEVATE_WORD_FIELDS = "fields";
    public static final String ELEVATE_WORD_TAGS = "tags";
    public static final String ELEVATE_WORD_ROLES = "roles";

    protected ArraySettings arraySettings;

    protected ElevateWordSettings(final SuggestSettings settings, final Client client, final String settingsIndexName,
            final String settingsId) {
        this.arraySettings = new ArraySettings(settings, client, settingsIndexName, settingsId) {
            @Override
            protected String createArraySettingsIndexName(final String settingsIndexName) {
                return settingsIndexName + "_elevate";
            }
        };
    }

// Path: src/main/java/org/codelibs/fess/suggest/constants/FieldNames.java
// public final class FieldNames {
//     public static final String ID = "_id";
//     public static final String TEXT = "text";
//     public static final String READING_PREFIX = "reading_";
//     public static final String SCORE = "score";
//     public static final String QUERY_FREQ = "queryFreq";
//     public static final String DOC_FREQ = "docFreq";
//     public static final String USER_BOOST = "userBoost";
//     public static final String KINDS = "kinds";
//     public static final String TIMESTAMP = "@timestamp";
//     public static final String TAGS = "tags";
//     public static final String ROLES = "roles";
//     public static final String FIELDS = "fields";
//     public static final String LANGUAGES = "languages";
// 
//     public static final String ARRAY_KEY = "key";
//     public static final String ARRAY_VALUE = "value";
// 
//     public static final String ANALYZER_SETTINGS_TYPE = "settingsType";
//     public static final String ANALYZER_SETTINGS_FIELD_NAME = "fieldName";
//     public static final String ANALYZER_SETTINGS_READING_ANALYZER = "readingAnalyzer";
//     public static final String ANALYZER_SETTINGS_READING_TERM_ANALYZER = "readingTermAnalyzer";
//     public static final String ANALYZER_SETTINGS_NORMALIZE_ANALYZER = "normalizeAnalyzer";
//     public static final String ANALYZER_SETTINGS_CONTENTS_ANALYZER = "contentsAnalyzer";
//     public static final String ANALYZER_SETTINGS_CONTENTS_READING_ANALYZER = "contentsReadingAnalyzer";
// 
//     private FieldNames() {
//     }
// }
// 
// Path: src/main/java/org/codelibs/fess/suggest/entity/ElevateWord.java
// public class ElevateWord {
// 
//     protected final String elevateWord;
//     protected final float boost;
//     protected final List<String> readings;
//     protected final List<String> fields;
//     protected final List<String> tags;
//     protected final List<String> roles;
// 
//     public ElevateWord(final String elevateWord, final float boost, final List<String> readings, final List<String> fields,
//             final List<String> tags, final List<String> roles) {
//         this.elevateWord = elevateWord;
//         this.boost = boost;
//         this.readings = readings;
//         this.fields = fields;
//         if (tags == null) {
//             this.tags = Collections.emptyList();
//         } else {
//             this.tags = tags;
//         }
//         if (roles == null) {
//             this.roles = Collections.emptyList();
//         } else {
//             this.roles = roles;
//         }
//     }
// 
//     public String getElevateWord() {
//         return elevateWord;
//     }
// 
//     public float getBoost() {
//         return boost;
//     }
// 
//     public List<String> getReadings() {
//         return readings;
//     }
// 
//     public List<String> getFields() {
//         return fields;
//     }
// 
//     public List<String> getTags() {
//         return tags;
//     }
// 
//     public List<String> getRoles() {
//         return roles;
//     }
// 
//     public SuggestItem toSuggestItem() {
//         final String[][] readingArray =
//                 this.getReadings().stream().map(reading -> new String[] { reading }).toArray(count -> new String[count][]);
//         return new SuggestItem(new String[] { this.getElevateWord() }, readingArray, fields.toArray(new String[fields.size()]), 1, 0,
//                 this.getBoost(), this.getTags().toArray(new String[this.getTags().size()]),
//                 this.getRoles().toArray(new String[this.getRoles().size()]), null, SuggestItem.Kind.USER);
//     }
// }


// Path: src/main/java/org/codelibs/fess/suggest/settings/ElevateWordSettings.java
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.codelibs.fess.suggest.constants.FieldNames;
import org.codelibs.fess.suggest.entity.ElevateWord;
import org.opensearch.client.Client;

/*
 * Copyright 2012-2022 CodeLibs Project and the Others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package org.codelibs.fess.suggest.settings;



public class ElevateWordSettings {
    private static final Logger logger = Logger.getLogger(ElevateWordSettings.class.getName());

    public static final String ELEVATE_WORD_SETTINGD_KEY = "elevateword";
    public static final String ELEVATE_WORD_BOOST = "boost";
    public static final String ELEVATE_WORD_READING = "reading";
    public static final String ELEVATE_WORD_FIELDS = "fields";
    public static final String ELEVATE_WORD_TAGS = "tags";
    public static final String ELEVATE_WORD_ROLES = "roles";

    protected ArraySettings arraySettings;

    protected ElevateWordSettings(final SuggestSettings settings, final Client client, final String settingsIndexName,
            final String settingsId) {
        this.arraySettings = new ArraySettings(settings, client, settingsIndexName, settingsId) {
            @Override
            protected String createArraySettingsIndexName(final String settingsIndexName) {
                return settingsIndexName + "_elevate";
            }
        };
    }

    public ElevateWord[] get() {