diff --git a/src/main/java/fr/abes/thesesapirecherche/theses/builder/SearchQueryBuilder.java b/src/main/java/fr/abes/thesesapirecherche/theses/builder/SearchQueryBuilder.java index a5c8421..97441ca 100644 --- a/src/main/java/fr/abes/thesesapirecherche/theses/builder/SearchQueryBuilder.java +++ b/src/main/java/fr/abes/thesesapirecherche/theses/builder/SearchQueryBuilder.java @@ -108,6 +108,7 @@ private String replaceSpacesOutsideQuotes(String input) { boolean insideQuotes = false; boolean insideBrackets = false; + for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); @@ -120,11 +121,22 @@ private String replaceSpacesOutsideQuotes(String input) { } else if (c == ']') { insideBrackets = false; result.append(c); - } else if (c == ' ' && !insideQuotes && !insideBrackets) { - result.append(" AND "); + } + else if (c == ' ') { + if (i + 2 < input.length() && input.charAt(i + 1) == 'O'&& input.charAt(i + 2) == 'R') { + + result.append(" OR "); + i+= 3; + } else if (!insideQuotes && !insideBrackets) { + result.append(" AND "); + } else { + result.append(c); + } } else { result.append(c); + } + } return result.toString();