-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix searching for Non-ASCII characters
- Loading branch information
1 parent
cc3c002
commit 909afe4
Showing
3 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/java/org/jabref/logic/search/LuceneQueryParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.jabref.logic.search; | ||
|
||
import java.util.EnumSet; | ||
import java.util.stream.Stream; | ||
|
||
import org.jabref.model.search.SearchFlags; | ||
import org.jabref.model.search.SearchQuery; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class LuceneQueryParserTest { | ||
|
||
public static Stream<Arguments> searchQuires() { | ||
return Stream.of( | ||
// unicode | ||
Arguments.of("preissinger", "preißinger"), | ||
Arguments.of("jesus", "jesús"), | ||
Arguments.of("breitenbucher", "breitenbücher"), | ||
|
||
// latex | ||
Arguments.of("preissinger", "prei{\\ss}inger"), | ||
Arguments.of("jesus", "jes{\\'{u}}s"), | ||
Arguments.of("breitenbucher", "breitenb{\\\"{u}}cher") | ||
); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource | ||
void searchQuires(String expected, String query) { | ||
expected = "(all:" + expected + ")^4.0"; | ||
SearchQuery searchQuery = new SearchQuery(query, EnumSet.noneOf(SearchFlags.class)); | ||
assertEquals(expected, searchQuery.getParsedQuery().toString()); | ||
} | ||
} |