X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fcommands%2FSearchCommand.java;fp=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fcommands%2FSearchCommand.java;h=e36b239c728162585cb085070cb47a81e3c8f7c5;hb=464c86e1706170a0be7be81d239d8c16fad78ec4;hp=1285b2ab656d909ee90e924fc74906d38dd4c682;hpb=d8b3b01004d7fa71658275822f569783f1c62047;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 1285b2a..e36b239 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java @@ -33,10 +33,20 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand } public void setQuery(String query) { - setParameter(new CommandParameter("query","=",query)); + setParameter(new QueryParameter("query","=",query)); + } + + public void setBooleanOperatorForQuery(String operator) { + Pazpar2Command copy = this.copy(); + ((QueryParameter) getParameter("query")).setBooleanOperator(operator); + checkInState(copy); } public String getQuery () { + return getParameter("query") == null ? null : getParameter("query").getSimpleValue(); + } + + public String getExtendedQuery () { return getParameter("query") == null ? null : getParameter("query").getValueWithExpressions(); } @@ -109,7 +119,7 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand if (getParameter("filter") == null) { setFilter(field + operator + value); } else { - getParameter("filter").addExpression(new Expression(field,operator,value,(label != null ? label : value))); + addExpression("filter",new Expression(field,operator,value,(label != null ? label : value))); } } @@ -255,8 +265,8 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand * @param term i.e. 'Dickens, Charles' */ public void setFacet(String facetKey, String term) { - if (term != null && term.length()>0) { - getParameter("query").addExpression(new Expression(facetKey,"=",term,null)); + if (term != null && term.length()>0) { + addExpression("query", new Expression(facetKey,"=",term,null)); } } @@ -288,7 +298,7 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand */ public void removeFacet(String facetKey, String term) { if (getParameter("query") != null) { - getParameter("query").removeExpression(new Expression(facetKey,"=",term,null)); + removeExpression("query",new Expression(facetKey,"=",term,null)); } }