Skip to content

Commit

Permalink
Fix space indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienFontaine committed Mar 21, 2019
1 parent c3e39f3 commit 399bac3
Showing 1 changed file with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,36 +403,37 @@ public Map<String, Node> get(String uri) {
}

private Query parseQuery(String queryString, Analyzer analyzer) throws ParseException {
Query query = null;
switch(queryParserType) {
case "QueryParser":
QueryParser qp = new QueryParser(docDef.getPrimaryField(), analyzer) ;
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
break;
case "AnalyzingQueryParser":
// AnalyzingQueryParser is deprecated in Lucene 7, switching to QueryParser
qp = new QueryParser(docDef.getPrimaryField(), analyzer) ;
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
break;
case "ComplexPhraseQueryParser":
qp = new ComplexPhraseQueryParser(docDef.getPrimaryField(), analyzer);
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
break;
case "SurroundQueryParser":
try {
query = org.apache.lucene.queryparser.surround.parser.QueryParser.parse(queryString).makeLuceneQueryField(docDef.getPrimaryField(), new BasicQueryFactory());
} catch(org.apache.lucene.queryparser.surround.parser.ParseException e) {
throw new ParseException(e.getMessage());
}
break;
default:
log.warn("Unknown query parser type '" + queryParserType + "'. Defaulting to standard QueryParser") ;
qp = new QueryParser(docDef.getPrimaryField(), analyzer) ;
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
Query query = null;

switch(queryParserType) {
case "QueryParser":
QueryParser qp = new QueryParser(docDef.getPrimaryField(), analyzer) ;
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
break;
case "AnalyzingQueryParser":
// AnalyzingQueryParser is deprecated in Lucene 7, switching to QueryParser
qp = new QueryParser(docDef.getPrimaryField(), analyzer) ;
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
break;
case "ComplexPhraseQueryParser":
qp = new ComplexPhraseQueryParser(docDef.getPrimaryField(), analyzer);
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
break;
case "SurroundQueryParser":
try {
query = org.apache.lucene.queryparser.surround.parser.QueryParser.parse(queryString).makeLuceneQueryField(docDef.getPrimaryField(), new BasicQueryFactory());
} catch(org.apache.lucene.queryparser.surround.parser.ParseException e) {
throw new ParseException(e.getMessage());
}
break;
default:
log.warn("Unknown query parser type '" + queryParserType + "'. Defaulting to standard QueryParser") ;
qp = new QueryParser(docDef.getPrimaryField(), analyzer) ;
qp.setAllowLeadingWildcard(true) ;
query = qp.parse(queryString);
}
return query ;
}
Expand Down

0 comments on commit 399bac3

Please sign in to comment.