mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-27 03:21:29 +01:00
fixed threading issue
This commit is contained in:
@@ -245,11 +245,12 @@ public final class CpeMemoryIndex {
|
|||||||
* @throws IOException is thrown if there is an issue with the underlying
|
* @throws IOException is thrown if there is an issue with the underlying
|
||||||
* Index
|
* Index
|
||||||
*/
|
*/
|
||||||
public TopDocs search(String searchString, int maxQueryResults) throws ParseException, IOException {
|
public synchronized TopDocs search(String searchString, int maxQueryResults) throws ParseException, IOException {
|
||||||
if (searchString == null || searchString.trim().isEmpty()) {
|
if (searchString == null || searchString.trim().isEmpty()) {
|
||||||
throw new ParseException("Query is null or empty");
|
throw new ParseException("Query is null or empty");
|
||||||
}
|
}
|
||||||
LOGGER.debug(searchString);
|
LOGGER.debug(searchString);
|
||||||
|
resetFieldAnalyzer();
|
||||||
final Query query = queryParser.parse(searchString);
|
final Query query = queryParser.parse(searchString);
|
||||||
return search(query, maxQueryResults);
|
return search(query, maxQueryResults);
|
||||||
}
|
}
|
||||||
@@ -263,7 +264,7 @@ public final class CpeMemoryIndex {
|
|||||||
* @throws CorruptIndexException thrown if the Index is corrupt
|
* @throws CorruptIndexException thrown if the Index is corrupt
|
||||||
* @throws IOException thrown if there is an IOException
|
* @throws IOException thrown if there is an IOException
|
||||||
*/
|
*/
|
||||||
public TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException {
|
public synchronized TopDocs search(Query query, int maxQueryResults) throws CorruptIndexException, IOException {
|
||||||
resetFieldAnalyzer();
|
resetFieldAnalyzer();
|
||||||
return indexSearcher.search(query, maxQueryResults);
|
return indexSearcher.search(query, maxQueryResults);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user