Revision 3053
Added by Matt Jones about 18 years ago
src/edu/ucsb/nceas/metacat/QueryTerm.java | ||
---|---|---|
140 | 140 |
// Add appropriate wildcards to search string |
141 | 141 |
String searchexpr = null; |
142 | 142 |
if (searchmode.equals("starts-with")) { |
143 |
searchexpr = nodedataterm + " = '" + casevalue + "%' ";
|
|
143 |
searchexpr = nodedataterm + " LIKE '" + casevalue + "%' ";
|
|
144 | 144 |
} else if (searchmode.equals("ends-with")) { |
145 |
searchexpr = nodedataterm + " = '%" + casevalue + "' ";
|
|
145 |
searchexpr = nodedataterm + " LIKE '%" + casevalue + "' ";
|
|
146 | 146 |
} else if (searchmode.equals("contains")) { |
147 | 147 |
if (!casevalue.equals("%")) { |
148 |
searchexpr = nodedataterm + " = '%" + casevalue + "%' ";
|
|
148 |
searchexpr = nodedataterm + " LIKE '%" + casevalue + "%' ";
|
|
149 | 149 |
} else { |
150 |
searchexpr = nodedataterm + " = '" + casevalue + "' ";
|
|
150 |
searchexpr = nodedataterm + " LIKE '" + casevalue + "' ";
|
|
151 | 151 |
// find percentage symbol |
152 | 152 |
percentageSymbol = true; |
153 | 153 |
} |
154 | 154 |
} else if (searchmode.equals("not-contains")) { |
155 | 155 |
notEqual = true; |
156 |
searchexpr = nodedataterm + " = '%" + casevalue + "%' ";
|
|
156 |
searchexpr = nodedataterm + " LIKE '%" + casevalue + "%' ";
|
|
157 | 157 |
} else if (searchmode.equals("equals")) { |
158 | 158 |
searchexpr = nodedataterm + " = '" + casevalue + "' "; |
159 | 159 |
} else if (searchmode.equals("isnot-equal")) { |
... | ... | |
208 | 208 |
self.append("SELECT DISTINCT docid from xml_path_index WHERE"); |
209 | 209 |
self.append(" docid NOT IN (Select docid FROM xml_path_index WHERE "); |
210 | 210 |
self.append(searchexpr); |
211 |
self.append("AND path = '" + pathexpr + "') ");
|
|
211 |
self.append("AND path LIKE '" + pathexpr + "') ");
|
|
212 | 212 |
} else { |
213 | 213 |
self.append("SELECT DISTINCT docid FROM xml_path_index WHERE "); |
214 | 214 |
self.append(searchexpr); |
215 |
self.append("AND path = '" + pathexpr + "' ");
|
|
215 |
self.append("AND path LIKE '" + pathexpr + "' ");
|
|
216 | 216 |
} |
217 | 217 |
|
218 | 218 |
} else { |
Also available in: Unified diff
Reverting to previous QueryTerm.java that uses 'LIKE' for comparisons. This
allows substring matching to work properly, but prevents the postgres index
from being used. As a result, full table scans are done on the tables, causing
a major performance hit. Need to determine how to eliminate the use of LIKE
while maintaining the ability to do substring matching with wildcards or
another mechanism.