Javadoc, and fixes some issues found along the way
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / commands / SearchCommand.java
index 1285b2a..e36b239 100644 (file)
@@ -33,10 +33,20 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand
   }\r
     \r
   public void setQuery(String query) {    \r
-    setParameter(new CommandParameter("query","=",query));\r
+    setParameter(new QueryParameter("query","=",query));\r
+  }\r
+  \r
+  public void setBooleanOperatorForQuery(String operator) {\r
+    Pazpar2Command copy = this.copy();\r
+    ((QueryParameter) getParameter("query")).setBooleanOperator(operator);\r
+    checkInState(copy);\r
   }\r
   \r
   public String getQuery () {    \r
+    return getParameter("query") == null ? null  : getParameter("query").getSimpleValue();\r
+  }\r
+  \r
+  public String getExtendedQuery () {    \r
     return getParameter("query") == null ? null  : getParameter("query").getValueWithExpressions();\r
   }\r
   \r
@@ -109,7 +119,7 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand
     if (getParameter("filter") == null) {\r
       setFilter(field + operator + value);\r
     } else {\r
-      getParameter("filter").addExpression(new Expression(field,operator,value,(label != null ? label : value)));\r
+      addExpression("filter",new Expression(field,operator,value,(label != null ? label : value)));\r
     }\r
   }\r
   \r
@@ -255,8 +265,8 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand
    * @param term  i.e. 'Dickens, Charles'\r
    */\r
   public void setFacet(String facetKey, String term) {\r
-    if (term != null && term.length()>0) {         \r
-      getParameter("query").addExpression(new Expression(facetKey,"=",term,null));            \r
+    if (term != null && term.length()>0) { \r
+      addExpression("query", new Expression(facetKey,"=",term,null));                  \r
     }            \r
   }\r
   \r
@@ -288,7 +298,7 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand
    */\r
   public void removeFacet(String facetKey, String term) {\r
     if (getParameter("query") != null) {\r
-      getParameter("query").removeExpression(new Expression(facetKey,"=",term,null));\r
+      removeExpression("query",new Expression(facetKey,"=",term,null));\r
     }\r
   }\r
       \r