“
a”是停用词,StandardAnalyzer会将其从查询中过滤掉。停用词是在您使用的搜索语言中足够普遍的词,并且对生成搜索结果没有意义。这是一个简短的列表,但是“
a”是英语中的一个。
由于分析器已经摆脱了该术语,并且它是当前存在的唯一术语,因此您现在正在发送一个空查询,这是不可接受的,并且搜索失败。
出于好奇,这些是标准的Lucene英语停用词:
"a", "an", "and", "are", "as", "at", "be", "but", "by","for", "if", "in", "into", "is", "it","no", "not", "of", "on", "or", "such","that", "the", "their", "then", "there", "these","they", "this", "to", "was", "will", "with"
如果您不希望删除停用词,则应设置
Analyzer不带
StopFilter或设置为空的停用词的。对于
StandardAnalyzer,您可以将自定义停止集传递给构造函数:
Analyzer analyzer = new StandardAnalyzer(CharArraySet.EMPTY_SET);



