Project

General

Profile

« Previous | Next » 

Revision 2373

Added by sgarg almost 20 years ago

Some more modifications so that % search doesnt run a select on xml_nodes.

View differences:

src/edu/ucsb/nceas/metacat/QuerySpecification.java
695 695
        // Get the query from the QueryGroup and check
696 696
        // if no query has been returned
697 697
        String queryFromQueryGroup = query.printSQL(useXMLIndex);
698
        if(!queryFromQueryGroup.trim().equals("()")){
698
        if(!queryFromQueryGroup.trim().equals("")){
699 699
            self.append(" docid IN (");
700
            self.append(query.printSQL(useXMLIndex));
700
            self.append(queryFromQueryGroup);
701 701
            self.append(") ");
702 702
        }
703 703

  
src/edu/ucsb/nceas/metacat/QueryGroup.java
89 89
     */
90 90
    public String printSQL(boolean useXMLIndex) {
91 91
      StringBuffer self = new StringBuffer();
92
      StringBuffer queryString = new StringBuffer();
93

  
92 94
      boolean first = true;
93 95

  
94
      self.append("(");
95

  
96 96
      Enumeration en= getChildren();
97 97
      while (en.hasMoreElements()) {
98 98
        Object qobject = en.nextElement();
99 99
        if (first) {
100 100
          first = false;
101 101
        } else {
102
          self.append(" " + operator + " ");
102
          queryString.append(" " + operator + " ");
103 103
        }
104 104
        if (qobject instanceof QueryGroup) {
105 105
          QueryGroup qg = (QueryGroup)qobject;
106
          self.append(qg.printSQL(useXMLIndex));
106
          queryString.append(qg.printSQL(useXMLIndex));
107 107
          // count percerntage number
108 108
          int count = qg.getPercentageSymbolCount();
109 109
          countPercentageSearchItem = countPercentageSearchItem + count;
110 110
        } else if (qobject instanceof QueryTerm) {
111 111
           QueryTerm qt = (QueryTerm)qobject;
112
           String queryString = qt.printSQL(useXMLIndex);
112
           String termQueryString = qt.printSQL(useXMLIndex);
113 113
           if(!(qt.getSearchMode().equals("contains") && qt.getValue().equals("%"))){
114
               self.append(queryString);
114
               queryString.append(termQueryString);
115 115
           }
116 116
           // count percerntage number
117 117
           int count = qt.getPercentageSymbolCount();
......
120 120
          System.err.println("qobject wrong type: fatal error");
121 121
        }
122 122
      }
123
      self.append(") \n");
123

  
124
      if(!queryString.toString().equals("")){
125
          self.append("(");
126
          self.append(queryString.toString());
127
          self.append(")");
128
      }
124 129
      return self.toString();
125 130
    }
126 131

  

Also available in: Unified diff