Revision 3052
Added by Matt Jones over 17 years ago
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 + " LIKE '" + casevalue + "%' ";
|
|
143 |
searchexpr = nodedataterm + " = '" + casevalue + "%' ";
|
|
144 | 144 |
} else if (searchmode.equals("ends-with")) { |
145 |
searchexpr = nodedataterm + " LIKE '%" + casevalue + "' ";
|
|
145 |
searchexpr = nodedataterm + " = '%" + casevalue + "' ";
|
|
146 | 146 |
} else if (searchmode.equals("contains")) { |
147 | 147 |
if (!casevalue.equals("%")) { |
148 |
searchexpr = nodedataterm + " LIKE '%" + casevalue + "%' ";
|
|
148 |
searchexpr = nodedataterm + " = '%" + casevalue + "%' ";
|
|
149 | 149 |
} else { |
150 |
searchexpr = nodedataterm + " LIKE '" + casevalue + "' ";
|
|
150 |
searchexpr = nodedataterm + " = '" + 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 + " LIKE '%" + casevalue + "%' ";
|
|
156 |
searchexpr = nodedataterm + " = '%" + 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 LIKE '" + pathexpr + "') ");
|
|
211 |
self.append("AND path = '" + 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 LIKE '" + pathexpr + "' ");
|
|
215 |
self.append("AND path = '" + pathexpr + "' ");
|
|
216 | 216 |
} |
217 | 217 |
|
218 | 218 |
} else { |
Also available in: Unified diff
Modifications to the table definitions to add indices that should be used
when searching the database. Added an upgrade script to create these
indices as well. Modified QueryTerm.java to use the '=' comparator rather
than 'LIKE' so that we can do index scans rather than table scans. This needs
to be tested.