fix #2767 add searcher
This commit is contained in:
parent
87318c70be
commit
95577ce58a
3 changed files with 23 additions and 0 deletions
|
@ -37,6 +37,8 @@ public class Constants extends CoreLibConstants {
|
|||
|
||||
public static final String SCORE = "score";
|
||||
|
||||
public static final String SEARCHER = "searcher";
|
||||
|
||||
public static final String ON = "on";
|
||||
|
||||
public static final String READY = "ready";
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.codelibs.core.collection.ArrayUtil;
|
||||
import org.codelibs.core.stream.StreamUtil;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.entity.SearchRequestParams;
|
||||
|
@ -30,6 +31,7 @@ import org.codelibs.fess.mylasta.action.FessUserBean;
|
|||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.rank.fusion.SearchResult.SearchResultBuilder;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.codelibs.fess.util.DocumentUtil;
|
||||
import org.codelibs.fess.util.FacetResponse;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
import org.dbflute.optional.OptionalThing;
|
||||
|
@ -188,6 +190,14 @@ public class DefaultSearcher extends RankFusionSearcher {
|
|||
if (!docMap.containsKey(fessConfig.getIndexFieldId())) {
|
||||
docMap.put(fessConfig.getIndexFieldId(), searchHit.getId());
|
||||
}
|
||||
|
||||
final String[] searchers = DocumentUtil.getValue(docMap, Constants.SEARCHER, String[].class);
|
||||
if (searchers != null) {
|
||||
docMap.put(Constants.SEARCHER, ArrayUtil.add(searchers, getName()));
|
||||
} else {
|
||||
docMap.put(Constants.SEARCHER, new String[] { getName() });
|
||||
}
|
||||
|
||||
return docMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,22 @@
|
|||
*/
|
||||
package org.codelibs.fess.rank.fusion;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.entity.SearchRequestParams;
|
||||
import org.codelibs.fess.mylasta.action.FessUserBean;
|
||||
import org.dbflute.optional.OptionalThing;
|
||||
|
||||
public abstract class RankFusionSearcher {
|
||||
protected String name;
|
||||
|
||||
public String getName() {
|
||||
if (name == null) {
|
||||
name = StringUtil.decamelize(this.getClass().getSimpleName().replace("Searcher", StringUtil.EMPTY)).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
protected abstract SearchResult search(String query, SearchRequestParams params, OptionalThing<FessUserBean> userBean);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue