X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fcommands%2FSearchCommand.java;h=0c8d7458f12d6aa16792dd563ee55bc7dcac08ad;hb=HEAD;hp=b8003cc689cf7714cfc40b8ce80b65e787dff1ba;hpb=dff9a63520eeb6c4d6fd6b5e286e8f6a06c5608a;p=mkjsf-moved-to-github.git
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java
index b8003cc..0c8d745 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java
@@ -70,16 +70,20 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand
/**
* Sets the filter
parameter. See Pazpar2 documentation for details.
*/
- public void setFilter(String filterExpression) {
- if (filterExpression != null && filterExpression.length()>0) {
- if (filterExpression.split("[=~]").length==1) {
- removeFilters(filterExpression.split("[=~]")[0]);
- } else if (filterExpression.split("[=~]").length==2) {
- setParameter(new FilterParameter(new Expression(filterExpression)));
- } else {
- logger.error("Could not parse filter expression [" + filterExpression + "]");
+ public void setFilter(String compoundExpression) {
+ if (getParameter("filter") != null) removeParameterInState("filter");
+ if (compoundExpression != null && compoundExpression.length()>0) {
+ // Split expression by commas that are not escaped with backslash
+ String[] subExpressions = compoundExpression.split("(?limit parameter. See Pazpar2 documentation for details.
*/
- public void setLimit (String limitExpression) {
- if (limitExpression != null && limitExpression.length()>0) {
- if (limitExpression.split("[=~]").length==1) {
- removeLimits(limitExpression.split("[=~]")[0]);
- } else if (limitExpression.split("[=~]").length==2) {
- setParameter(new LimitParameter(new Expression(limitExpression)));
- } else {
- logger.error("Could not parse limit expression [" + limitExpression + "]");
+ public void setLimit (String compoundExpression) {
+ if (getParameter("limit") != null) removeParameterInState("limit");
+ if (compoundExpression != null && compoundExpression.length()>0) {
+ // Split expression by commas that are not escaped with backslash
+ String[] subExpressions = compoundExpression.split("(?expressionFields
+ * Returns a list of limit expressions with fields that matches one of expressionFields
*
* @param expressionFields limit expressions to look for
*/