fix #165
This commit is contained in:
parent
2f129f3d14
commit
df6089e5b5
5 changed files with 1302 additions and 1064 deletions
|
@ -320,4 +320,6 @@ public class Constants extends CoreLibConstants {
|
|||
|
||||
public static final String ALL_LANGUAGES = "all";
|
||||
|
||||
public static final String DEFAULT_OPERATOR = "defaultOperator";
|
||||
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ public class IndexAction {
|
|||
|
||||
public String getPagingQuery() {
|
||||
if (pagingQuery == null) {
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
final StringBuilder buf = new StringBuilder(200);
|
||||
if (indexForm.additional != null) {
|
||||
final Set<String> fieldSet = new HashSet<String>();
|
||||
for (final String additional : indexForm.additional) {
|
||||
|
@ -241,6 +241,9 @@ public class IndexAction {
|
|||
if (StringUtil.isNotBlank(indexForm.sort)) {
|
||||
buf.append("&sort=").append(S2Functions.u(indexForm.sort));
|
||||
}
|
||||
if (StringUtil.isNotBlank(indexForm.op)) {
|
||||
buf.append("&op=").append(S2Functions.u(indexForm.op));
|
||||
}
|
||||
if (indexForm.lang != null) {
|
||||
final Set<String> langSet = new HashSet<String>();
|
||||
for (final String lang : indexForm.lang) {
|
||||
|
@ -894,6 +897,9 @@ public class IndexAction {
|
|||
if (StringUtil.isNotBlank(indexForm.query)) {
|
||||
queryBuf.append(indexForm.query);
|
||||
}
|
||||
if (StringUtil.isNotBlank(indexForm.op)) {
|
||||
request.setAttribute(Constants.DEFAULT_OPERATOR, indexForm.op);
|
||||
}
|
||||
if (!indexForm.fields.isEmpty()) {
|
||||
for (final Map.Entry<String, String[]> entry : indexForm.fields
|
||||
.entrySet()) {
|
||||
|
|
|
@ -39,6 +39,9 @@ public class IndexForm implements Serializable {
|
|||
@Maxbytelength(maxbytelength = 1000)
|
||||
public String sort;
|
||||
|
||||
@Maxbytelength(maxbytelength = 10)
|
||||
public String op;
|
||||
|
||||
@IntegerType
|
||||
public String start;
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ public class QueryHelper implements Serializable {
|
|||
|
||||
final StringBuilder queryBuf = new StringBuilder(255);
|
||||
final List<String> notOperatorList = new ArrayList<String>();
|
||||
String defaultOperator = getDefaultOperator();
|
||||
final String defaultOperator = getDefaultOperator();
|
||||
String operator = defaultOperator;
|
||||
boolean notOperatorFlag = false;
|
||||
int queryOperandCount = 0;
|
||||
|
@ -798,7 +798,7 @@ public class QueryHelper implements Serializable {
|
|||
|
||||
final StringBuilder queryBuf = new StringBuilder(255);
|
||||
final List<String> notOperatorList = new ArrayList<String>();
|
||||
String defaultOperator = getDefaultOperator();
|
||||
final String defaultOperator = getDefaultOperator();
|
||||
String operator = defaultOperator;
|
||||
boolean notOperatorFlag = false;
|
||||
int queryOperandCount = 0;
|
||||
|
@ -1464,6 +1464,16 @@ public class QueryHelper implements Serializable {
|
|||
}
|
||||
|
||||
protected String getDefaultOperator() {
|
||||
final HttpServletRequest request = RequestUtil.getRequest();
|
||||
if (request != null) {
|
||||
final String defaultOperator = (String) request
|
||||
.getAttribute(Constants.DEFAULT_OPERATOR);
|
||||
if (AND.equalsIgnoreCase(defaultOperator)) {
|
||||
return _AND_;
|
||||
} else if (OR.equalsIgnoreCase(defaultOperator)) {
|
||||
return _OR_;
|
||||
}
|
||||
}
|
||||
return DEFAULT_OPERATOR;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue