isResultSetIndex() recognises cql.* indexes as well as srw.*
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLTermNode.java
index fc310ed..1d500a7 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: CQLTermNode.java,v 1.25 2007-06-27 22:39:55 mike Exp $
+// $Id: CQLTermNode.java,v 1.27 2007-06-29 15:26:29 mike Exp $
 
 package org.z3950.zing.cql;
 import java.util.Properties;
@@ -12,7 +12,7 @@ import java.util.Vector;
  * these must be provided - you can't have an index without a
  * relation or vice versa.
  *
- * @version    $Id: CQLTermNode.java,v 1.25 2007-06-27 22:39:55 mike Exp $
+ * @version    $Id: CQLTermNode.java,v 1.27 2007-06-29 15:26:29 mike Exp $
  */
 public class CQLTermNode extends CQLNode {
     private String index;
@@ -31,14 +31,16 @@ public class CQLTermNode extends CQLNode {
     }
 
     public String getIndex() { return index; }
-    public String getQualifier() { return getIndex(); } // for legacy applications
     public CQLRelation getRelation() { return relation; }
     public String getTerm() { return term; }
 
     private static boolean isResultSetIndex(String qual) {
        return (qual.equals("srw.resultSet") ||
                qual.equals("srw.resultSetId") ||
-               qual.equals("srw.resultSetName"));
+               qual.equals("srw.resultSetName") ||
+               qual.equals("cql.resultSet") ||
+               qual.equals("cql.resultSetId") ||
+               qual.equals("cql.resultSetName"));
     }
 
     public String getResultSetName() {
@@ -63,7 +65,8 @@ public class CQLTermNode extends CQLNode {
        String res = quotedTerm;
 
        if (index != null &&
-           !index.equalsIgnoreCase("srw.serverChoice")) {
+           !index.equalsIgnoreCase("srw.serverChoice") &&
+           !index.equalsIgnoreCase("cql.serverChoice")) {
            // ### We don't always need spaces around `relation'.
            res = quotedIndex + " " + relation.toCQL() + " " + quotedTerm;
        }
@@ -91,7 +94,7 @@ public class CQLTermNode extends CQLNode {
 
        attr = config.getProperty("index." + index);
        if (attr == null)
-           throw new UnknownQualifierException(index);
+           throw new UnknownIndexException(index);
        attrs.add(attr);
 
        String rel = relation.getBase();