fix #1657 add processAPISearchPreference methods
This commit is contained in:
parent
09d70144c6
commit
8ab5b2def5
1 changed files with 19 additions and 8 deletions
|
@ -32,6 +32,7 @@ import java.util.stream.Stream;
|
|||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.lucene.index.Term;
|
||||
|
@ -750,20 +751,30 @@ public class QueryHelper {
|
|||
}
|
||||
final Object accessType = r.getAttribute(Constants.SEARCH_LOG_ACCESS_TYPE);
|
||||
if (Constants.SEARCH_LOG_ACCESS_TYPE_JSON.equals(accessType)) {
|
||||
final String pref = fessConfig.getQueryJsonDefaultPreference();
|
||||
if (StringUtil.isNotBlank(pref)) {
|
||||
return pref;
|
||||
}
|
||||
return processJsonSearchPreference(r);
|
||||
} else if (Constants.SEARCH_LOG_ACCESS_TYPE_GSA.equals(accessType)) {
|
||||
final String pref = fessConfig.getQueryGsaDefaultPreference();
|
||||
if (StringUtil.isNotBlank(pref)) {
|
||||
return pref;
|
||||
}
|
||||
return processGsaSearchPreference(r);
|
||||
}
|
||||
return null;
|
||||
}).ifPresent(p -> searchRequestBuilder.setPreference(p)));
|
||||
}
|
||||
|
||||
protected String processJsonSearchPreference(final HttpServletRequest req) {
|
||||
final String pref = fessConfig.getQueryJsonDefaultPreference();
|
||||
if (StringUtil.isNotBlank(pref)) {
|
||||
return pref;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String processGsaSearchPreference(final HttpServletRequest req) {
|
||||
final String pref = fessConfig.getQueryGsaDefaultPreference();
|
||||
if (StringUtil.isNotBlank(pref)) {
|
||||
return pref;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the responseFields
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue