Search in sources :

Example 21 with FessConfig

use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.

the class ElevateWord method getLabelTypeList.

public List<LabelType> getLabelTypeList() {
    if (labelTypeList == null) {
        synchronized (this) {
            if (labelTypeList == null) {
                final FessConfig fessConfig = ComponentUtil.getFessConfig();
                final WebConfigToLabelBhv webConfigToLabelBhv = ComponentUtil.getComponent(WebConfigToLabelBhv.class);
                final ListResultBean<WebConfigToLabel> mappingList = webConfigToLabelBhv.selectList(cb -> {
                    cb.query().setWebConfigId_Equal(getId());
                    cb.specify().columnLabelTypeId();
                    cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger().intValue(), 1);
                });
                final List<String> labelIdList = new ArrayList<>();
                for (final WebConfigToLabel mapping : mappingList) {
                    labelIdList.add(mapping.getLabelTypeId());
                }
                final LabelTypeBhv labelTypeBhv = ComponentUtil.getComponent(LabelTypeBhv.class);
                labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
                    cb.query().setId_InScope(labelIdList);
                    cb.query().addOrderBy_SortOrder_Asc();
                    cb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
                });
            }
        }
    }
    return labelTypeList;
}
Also used : WebConfigToLabelBhv(org.codelibs.fess.es.config.exbhv.WebConfigToLabelBhv) ArrayList(java.util.ArrayList) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) LabelTypeBhv(org.codelibs.fess.es.config.exbhv.LabelTypeBhv)

Example 22 with FessConfig

use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.

the class LabelType method getRoleTypeList.

public List<RoleType> getRoleTypeList() {
    if (roleTypeList == null) {
        synchronized (this) {
            if (roleTypeList == null) {
                final FessConfig fessConfig = ComponentUtil.getFessConfig();
                final LabelToRoleBhv labelToRoleBhv = ComponentUtil.getComponent(LabelToRoleBhv.class);
                final ListResultBean<LabelToRole> mappingList = labelToRoleBhv.selectList(cb -> {
                    cb.query().setLabelTypeId_Equal(getId());
                    cb.specify().columnRoleTypeId();
                    cb.paging(fessConfig.getPageRoletypeMaxFetchSizeAsInteger().intValue(), 1);
                });
                final List<String> roleIdList = new ArrayList<>();
                for (final LabelToRole mapping : mappingList) {
                    roleIdList.add(mapping.getRoleTypeId());
                }
                final RoleTypeBhv roleTypeBhv = ComponentUtil.getComponent(RoleTypeBhv.class);
                roleTypeList = roleIdList.isEmpty() ? Collections.emptyList() : roleTypeBhv.selectList(cb -> {
                    cb.query().setId_InScope(roleIdList);
                    cb.query().addOrderBy_SortOrder_Asc();
                    cb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
                });
            }
        }
    }
    return roleTypeList;
}
Also used : ArrayList(java.util.ArrayList) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) RoleTypeBhv(org.codelibs.fess.es.config.exbhv.RoleTypeBhv) LabelToRoleBhv(org.codelibs.fess.es.config.exbhv.LabelToRoleBhv)

Example 23 with FessConfig

use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.

the class DataConfig method getLabelTypeList.

public List<LabelType> getLabelTypeList() {
    if (labelTypeList == null) {
        synchronized (this) {
            if (labelTypeList == null) {
                final FessConfig fessConfig = ComponentUtil.getFessConfig();
                final DataConfigToLabelBhv dataConfigToLabelBhv = ComponentUtil.getComponent(DataConfigToLabelBhv.class);
                final ListResultBean<DataConfigToLabel> mappingList = dataConfigToLabelBhv.selectList(cb -> {
                    cb.query().setDataConfigId_Equal(getId());
                    cb.specify().columnLabelTypeId();
                    cb.paging(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger().intValue(), 1);
                });
                final List<String> labelIdList = new ArrayList<>();
                for (final DataConfigToLabel mapping : mappingList) {
                    labelIdList.add(mapping.getLabelTypeId());
                }
                final LabelTypeBhv labelTypeBhv = ComponentUtil.getComponent(LabelTypeBhv.class);
                labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
                    cb.query().setId_InScope(labelIdList);
                    cb.query().addOrderBy_SortOrder_Asc();
                    cb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
                });
            }
        }
    }
    return labelTypeList;
}
Also used : ArrayList(java.util.ArrayList) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) LabelTypeBhv(org.codelibs.fess.es.config.exbhv.LabelTypeBhv) DataConfigToLabelBhv(org.codelibs.fess.es.config.exbhv.DataConfigToLabelBhv)

Example 24 with FessConfig

use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.

the class User method getPermissions.

@Override
public String[] getPermissions() {
    final FessConfig fessConfig = ComponentUtil.getFessConfig();
    final List<String> list = new ArrayList<>();
    list.add(fessConfig.getRoleSearchUserPrefix() + getName());
    stream(getRoles()).of(stream -> stream.forEach(s -> list.add(fessConfig.getRoleSearchRolePrefix() + decode(s))));
    stream(getGroups()).of(stream -> stream.forEach(s -> list.add(fessConfig.getRoleSearchGroupPrefix() + decode(s))));
    return list.toArray(new String[list.size()]);
}
Also used : Arrays(java.util.Arrays) Base64(java.util.Base64) List(java.util.List) Constants(org.codelibs.fess.Constants) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) StreamUtil.stream(org.codelibs.core.stream.StreamUtil.stream) BsUser(org.codelibs.fess.es.user.bsentity.BsUser) ComponentUtil(org.codelibs.fess.util.ComponentUtil) Map(java.util.Map) HashMap(java.util.HashMap) FessUser(org.codelibs.fess.entity.FessUser) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig)

Example 25 with FessConfig

use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.

the class KeyMatchHelper method getBoostedDocumentList.

public List<Map<String, Object>> getBoostedDocumentList(final String term, final int size) {
    final FessEsClient fessEsClient = ComponentUtil.getFessEsClient();
    final Pair<QueryBuilder, ScoreFunctionBuilder> pair = keyMatchQueryMap.get(toLowerCase(term));
    if (pair == null) {
        return Collections.emptyList();
    }
    final FessConfig fessConfig = ComponentUtil.getFessConfig();
    return fessEsClient.getDocumentList(fessConfig.getIndexDocumentSearchIndex(), fessConfig.getIndexDocumentType(), searchRequestBuilder -> {
        searchRequestBuilder.setPreference(Constants.SEARCH_PREFERENCE_PRIMARY).setQuery(pair.getFirst()).setSize(size);
        return true;
    });
}
Also used : ScoreFunctionBuilder(org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder) FessEsClient(org.codelibs.fess.es.client.FessEsClient) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig)

Aggregations

FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)108 ArrayList (java.util.ArrayList)41 Map (java.util.Map)33 HashMap (java.util.HashMap)32 List (java.util.List)27 ComponentUtil (org.codelibs.fess.util.ComponentUtil)27 Logger (org.slf4j.Logger)26 LoggerFactory (org.slf4j.LoggerFactory)26 StringUtil (org.codelibs.core.lang.StringUtil)24 Constants (org.codelibs.fess.Constants)22 StreamUtil.stream (org.codelibs.core.stream.StreamUtil.stream)21 IOException (java.io.IOException)15 SystemHelper (org.codelibs.fess.helper.SystemHelper)15 PostConstruct (javax.annotation.PostConstruct)14 FessSystemException (org.codelibs.fess.exception.FessSystemException)14 File (java.io.File)11 Date (java.util.Date)11 QueryBuilder (org.elasticsearch.index.query.QueryBuilder)11 Hashtable (java.util.Hashtable)10 FessEsClient (org.codelibs.fess.es.client.FessEsClient)9