|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2014, 2015 IBM Corporation and others. |
2 |
* Copyright (c) 2014, 2016 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 195-200
Link Here
|
| 195 |
*/ |
195 |
*/ |
| 196 |
public List<SearchResult> search(SearchOptions options) throws SearchException { |
196 |
public List<SearchResult> search(SearchOptions options) throws SearchException { |
| 197 |
List<SearchResult> files = new LinkedList<SearchResult>(); |
197 |
List<SearchResult> files = new LinkedList<SearchResult>(); |
|
|
198 |
if(!options.isFileContentsSearch() && options.getFilenamePattern() == null) { |
| 199 |
return files; |
| 200 |
} |
| 198 |
try { |
201 |
try { |
| 199 |
for (SearchScope scope : options.getScopes()) { |
202 |
for (SearchScope scope : options.getScopes()) { |
| 200 |
currentWorkspace = scope.getWorkspace(); |
203 |
currentWorkspace = scope.getWorkspace(); |
|
Lines 252-262
Link Here
|
| 252 |
* @return the correct search term. |
255 |
* @return the correct search term. |
| 253 |
*/ |
256 |
*/ |
| 254 |
private String undoLuceneEscape(String searchTerm) { |
257 |
private String undoLuceneEscape(String searchTerm) { |
| 255 |
String specialChars = "+-&|!(){}[]^\"~:\\"; |
258 |
if(searchTerm != null) { |
| 256 |
for (int i = 0; i < specialChars.length(); i++) { |
259 |
String specialChars = "+-&|!(){}[]^\"~:\\"; |
| 257 |
String character = specialChars.substring(i, i + 1); |
260 |
for (int i = 0; i < specialChars.length(); i++) { |
| 258 |
String escaped = "\\" + character; |
261 |
String character = specialChars.substring(i, i + 1); |
| 259 |
searchTerm = searchTerm.replaceAll(Pattern.quote(escaped), character); |
262 |
String escaped = "\\" + character; |
|
|
263 |
searchTerm = searchTerm.replaceAll(Pattern.quote(escaped), character); |
| 264 |
} |
| 260 |
} |
265 |
} |
| 261 |
return searchTerm; |
266 |
return searchTerm; |
| 262 |
} |
267 |
} |