Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczi committed Nov 8, 2023
1 parent bc48a64 commit d776af3
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,8 @@ public NYCFilterFactory(Map<String, String> args) {
}

@Override
protected SynonymMap loadSynonyms(ResourceLoader loader,
String cname,
boolean dedup,
Analyzer analyzer) throws IOException, ParseException {
protected SynonymMap loadSynonyms(ResourceLoader loader, String cname, boolean dedup, Analyzer analyzer) throws IOException,
ParseException {
SynonymMap.Parser parser = new SolrSynonymParser(false, false, analyzer);
parser.parse(new StringReader("new york city => nyc, new york city"));
return parser.build();
Expand All @@ -383,20 +381,22 @@ protected SynonymMap loadSynonyms(ResourceLoader loader,
public void testOverlappingPositions() throws Exception {
final String[] inputs = { "new york city" };
final String[] outputs = { "<b>new york city</b>" };
BooleanQuery query = new BooleanQuery.Builder()
.add(new BooleanQuery.Builder()
.add(new TermQuery(new Term("text", "nyc")), BooleanClause.Occur.SHOULD)
.add(new BooleanQuery.Builder()
.add(new TermQuery(new Term("text", "new")), BooleanClause.Occur.MUST)
.add(new TermQuery(new Term("text", "york")), BooleanClause.Occur.MUST)
.add(new TermQuery(new Term("text", "city")), BooleanClause.Occur.MUST)
.build(), BooleanClause.Occur.SHOULD)
.build(), BooleanClause.Occur.MUST)
.build();
BooleanQuery query = new BooleanQuery.Builder().add(
new BooleanQuery.Builder().add(new TermQuery(new Term("text", "nyc")), BooleanClause.Occur.SHOULD)
.add(
new BooleanQuery.Builder().add(new TermQuery(new Term("text", "new")), BooleanClause.Occur.MUST)
.add(new TermQuery(new Term("text", "york")), BooleanClause.Occur.MUST)
.add(new TermQuery(new Term("text", "city")), BooleanClause.Occur.MUST)
.build(),
BooleanClause.Occur.SHOULD
)
.build(),
BooleanClause.Occur.MUST
).build();
Analyzer analyzer = CustomAnalyzer.builder()
.withTokenizer(StandardTokenizerFactory.class)
.addTokenFilter(NYCFilterFactory.class, "synonyms", "N/A")
.build();
.withTokenizer(StandardTokenizerFactory.class)
.addTokenFilter(NYCFilterFactory.class, "synonyms", "N/A")
.build();
assertHighlightOneDoc("text", inputs, analyzer, query, Locale.ROOT, BreakIterator.getSentenceInstance(Locale.ROOT), 0, outputs);
}

Expand Down

0 comments on commit d776af3

Please sign in to comment.