我正在使用 Apache Solr,假设我搜索“B”我希望 Solr 返回“AB”、“BA”、“ABA”
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
query.addFilterQuery("color:*B*");
但是,它抛出异常,我该怎么办?
Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'color:*B*': '*' or '?' not allowed as first character in WildcardQuery
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211)
at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:80)
at org.apache.solr.search.QParser.getQuery(QParser.java:142)
at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:114)
... 17 more
Caused by: org.apache.lucene.queryParser.ParseException: '*' or '?' not allowed as first character in WildcardQuery