use of io.zulia.message.ZuliaIndex.FieldConfig in project zuliasearch by zuliaio.
the class FieldConfigMapper method getFieldConfigs.
public List<FieldConfig> getFieldConfigs() {
List<FieldConfig> configs = new ArrayList<>();
for (String fieldName : fieldConfigMap.keySet()) {
FieldConfig fieldConfig = fieldConfigMap.get(fieldName);
configs.add(fieldConfig);
}
for (FieldConfigMapper fcm : embeddedFieldConfigMappers) {
configs.addAll(fcm.getFieldConfigs());
}
LOG.info(configs.toString());
return configs;
}
use of io.zulia.message.ZuliaIndex.FieldConfig in project zuliasearch by zuliaio.
the class ServerIndexConfig method configure.
public void configure(IndexSettings indexSettings) {
this.indexSettings = indexSettings;
this.analyzerMap = new ConcurrentHashMap<>();
analyzerMap.put(DefaultAnalyzers.STANDARD, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.STANDARD).addFilter(Filter.LOWERCASE).addFilter(Filter.STOPWORDS).build());
analyzerMap.put(DefaultAnalyzers.KEYWORD, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.KEYWORD).setTokenizer(Tokenizer.KEYWORD).build());
analyzerMap.put(DefaultAnalyzers.LC_KEYWORD, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.LC_KEYWORD).setTokenizer(Tokenizer.KEYWORD).addFilter(Filter.LOWERCASE).build());
analyzerMap.put(DefaultAnalyzers.MIN_STEM, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.MIN_STEM).setTokenizer(Tokenizer.STANDARD).addFilter(Filter.LOWERCASE).addFilter(Filter.STOPWORDS).addFilter(Filter.ENGLISH_MIN_STEM).build());
analyzerMap.put(DefaultAnalyzers.TWO_TWO_SHINGLE, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.TWO_TWO_SHINGLE).setTokenizer(Tokenizer.STANDARD).addFilter(Filter.LOWERCASE).addFilter(Filter.TWO_TWO_SHINGLE).build());
analyzerMap.put(DefaultAnalyzers.THREE_THREE_SHINGLE, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.THREE_THREE_SHINGLE).setTokenizer(Tokenizer.STANDARD).addFilter(Filter.LOWERCASE).addFilter(Filter.THREE_THREE_SHINGLE).build());
analyzerMap.put(DefaultAnalyzers.LC_CONCAT_ALL, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.LC_CONCAT_ALL).setTokenizer(Tokenizer.KEYWORD).addFilter(Filter.LOWERCASE).addFilter(Filter.CONCAT_ALL).build());
analyzerMap.put(DefaultAnalyzers.KSTEMMED, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.KSTEMMED).setTokenizer(Tokenizer.STANDARD).addFilter(Filter.LOWERCASE).addFilter(Filter.STOPWORDS).addFilter(Filter.KSTEM).build());
analyzerMap.put(DefaultAnalyzers.LSH, AnalyzerSettings.newBuilder().setName(DefaultAnalyzers.LSH).setTokenizer(Tokenizer.STANDARD).addFilter(Filter.LOWERCASE).addFilter(Filter.ASCII_FOLDING).addFilter(Filter.KSTEM).addFilter(Filter.STOPWORDS).addFilter(Filter.FIVE_FIVE_SHINGLE).addFilter(Filter.MINHASH).build());
for (AnalyzerSettings analyzerSettings : indexSettings.getAnalyzerSettingsList()) {
analyzerMap.put(analyzerSettings.getName(), analyzerSettings);
}
this.fieldConfigMap = new ConcurrentHashMap<>();
for (FieldConfig fc : indexSettings.getFieldConfigList()) {
fieldConfigMap.put(fc.getStoredFieldName(), fc);
}
this.indexAsMap = new ConcurrentHashMap<>();
this.indexToStoredMap = new ConcurrentHashMap<>();
for (String storedFieldName : fieldConfigMap.keySet()) {
FieldConfig fc = fieldConfigMap.get(storedFieldName);
for (IndexAs indexAs : fc.getIndexAsList()) {
indexAsMap.put(indexAs.getIndexFieldName(), indexAs);
indexToStoredMap.put(indexAs.getIndexFieldName(), storedFieldName);
}
}
this.facetAsMap = new ConcurrentHashMap<>();
for (String storedFieldName : fieldConfigMap.keySet()) {
FieldConfig fc = fieldConfigMap.get(storedFieldName);
for (FacetAs facetAs : fc.getFacetAsList()) {
facetAsMap.put(facetAs.getFacetName(), facetAs);
}
}
this.indexFieldType = new ConcurrentHashMap<>();
for (String storedFieldName : fieldConfigMap.keySet()) {
FieldConfig fc = fieldConfigMap.get(storedFieldName);
for (IndexAs indexAs : fc.getIndexAsList()) {
indexFieldType.put(indexAs.getIndexFieldName(), fc.getFieldType());
}
}
this.sortFieldType = new ConcurrentHashMap<>();
for (String storedFieldName : fieldConfigMap.keySet()) {
FieldConfig fc = fieldConfigMap.get(storedFieldName);
for (SortAs sortAs : fc.getSortAsList()) {
sortFieldType.put(sortAs.getSortFieldName(), fc.getFieldType());
}
}
this.superbitConfigMap = new ConcurrentHashMap<>();
this.superbitMap = new ConcurrentHashMap<>();
for (String storedFieldName : fieldConfigMap.keySet()) {
FieldConfig fc = fieldConfigMap.get(storedFieldName);
for (ProjectAs projectAs : fc.getProjectAsList()) {
String field = projectAs.getField();
if (projectAs.hasSuperbit()) {
Superbit superbit = projectAs.getSuperbit();
superbitConfigMap.put(field, superbit);
SuperBit superBit = new SuperBit(superbit.getInputDim(), superbit.getInputDim(), superbit.getBatches(), superbit.getSeed());
superbitMap.put(field, superBit);
}
}
}
}
use of io.zulia.message.ZuliaIndex.FieldConfig in project zuliasearch by zuliaio.
the class ClientIndexConfig method configure.
public void configure(IndexSettings indexSettings) {
this.indexName = indexSettings.getIndexName();
this.numberOfShards = indexSettings.getNumberOfShards();
this.numberOfReplicas = indexSettings.getNumberOfReplicas();
this.defaultSearchFields = indexSettings.getDefaultSearchFieldList();
this.analyzerSettingsMap = new TreeMap<>();
for (AnalyzerSettings analyzerSettings : indexSettings.getAnalyzerSettingsList()) {
analyzerSettingsMap.put(analyzerSettings.getName(), analyzerSettings);
}
this.fieldMap = new TreeMap<>();
for (FieldConfig fc : indexSettings.getFieldConfigList()) {
fieldMap.put(fc.getStoredFieldName(), fc);
}
this.requestFactor = indexSettings.getRequestFactor();
this.minShardRequest = indexSettings.getMinShardRequest();
this.shardTolerance = indexSettings.getShardTolerance();
this.shardQueryCacheSize = indexSettings.getShardQueryCacheSize();
this.shardQueryCacheMaxAmount = indexSettings.getShardQueryCacheMaxAmount();
this.idleTimeWithoutCommit = indexSettings.getIdleTimeWithoutCommit();
this.shardCommitInterval = indexSettings.getShardCommitInterval();
this.indexWeight = indexSettings.getIndexWeight();
this.ramBufferMB = indexSettings.getRamBufferMB();
}
use of io.zulia.message.ZuliaIndex.FieldConfig in project zuliasearch by zuliaio.
the class ClientIndexConfig method getIndexSettings.
public IndexSettings getIndexSettings() {
IndexSettings.Builder isb = IndexSettings.newBuilder();
if (numberOfShards != null) {
isb.setNumberOfShards(numberOfShards);
}
if (indexName != null) {
isb.setIndexName(indexName);
}
if (defaultSearchFields != null) {
isb.addAllDefaultSearchField(defaultSearchFields);
}
if (requestFactor != null) {
isb.setRequestFactor(requestFactor);
}
if (minShardRequest != null) {
isb.setMinShardRequest(minShardRequest);
}
if (shardCommitInterval != null) {
isb.setShardCommitInterval(shardCommitInterval);
}
if (idleTimeWithoutCommit != null) {
isb.setIdleTimeWithoutCommit(idleTimeWithoutCommit);
}
if (shardTolerance != null) {
isb.setShardTolerance(shardTolerance);
}
if (indexWeight != null) {
isb.setIndexWeight(indexWeight);
}
if (ramBufferMB != null) {
isb.setRamBufferMB(ramBufferMB);
}
for (String fieldName : fieldMap.keySet()) {
FieldConfig fieldConfig = fieldMap.get(fieldName);
isb.addFieldConfig(fieldConfig);
}
for (String analyzerName : analyzerSettingsMap.keySet()) {
isb.addAnalyzerSettings(analyzerSettingsMap.get(analyzerName));
}
return isb.build();
}
use of io.zulia.message.ZuliaIndex.FieldConfig in project zuliasearch by zuliaio.
the class Mapper method createOrUpdateIndex.
public CreateIndex createOrUpdateIndex() {
if (settings == null) {
throw new RuntimeException("No Settings annotation for class <" + clazz.getSimpleName() + ">");
}
ClientIndexConfig indexConfig = new ClientIndexConfig();
for (DefaultSearchFieldInfo<T> defaultSearchField : defaultSearchFields) {
indexConfig.addDefaultSearchField(defaultSearchField.getFieldName());
}
indexConfig.setIndexName(settings.indexName());
indexConfig.setNumberOfShards(settings.numberOfShards());
indexConfig.setRequestFactor(settings.requestFactor());
indexConfig.setMinShardRequest(settings.minSeqmentRequest());
indexConfig.setIdleTimeWithoutCommit(settings.idleTimeWithoutCommit());
indexConfig.setShardCommitInterval(settings.shardCommitInterval());
indexConfig.setShardTolerance(settings.shardTolerance());
indexConfig.setShardQueryCacheSize(settings.shardQueryCacheSize());
indexConfig.setShardQueryCacheMaxAmount(settings.shardQueryCacheMaxAmount());
for (FieldConfig fieldConfig : fieldConfigMapper.getFieldConfigs()) {
indexConfig.addFieldConfig(fieldConfig);
}
return new CreateIndex(indexConfig);
}
Aggregations