Lucene 特殊字符的使用

Lucene 特殊字符的使用,lucene,aem,Lucene,Aem,我想使用CQs QueryBuilder进行全文搜索: type=cq:Page path=/content/page fulltext=#Employees 尝试这样做会给我匹配单词“Employees”的命中率,即使我在查询中使用hash作为“Employees” 无法看到QueryBuilder修改了查询,但Lucene是否可能删除了哈希 我不确定cq5,但如果使用了StandardAnalyzer,Lucene确实会在标记化和查询时删除哈希键,如所示 此代码 public static

我想使用CQs QueryBuilder进行全文搜索:

type=cq:Page
path=/content/page
fulltext=#Employees
尝试这样做会给我匹配单词“Employees”的命中率,即使我在查询中使用hash作为“Employees”


无法看到QueryBuilder修改了查询,但Lucene是否可能删除了哈希

我不确定cq5,但如果使用了
StandardAnalyzer
,Lucene确实会在标记化和查询时删除哈希键,如所示

此代码

public static void main(String[] args) throws IOException {
    StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_46);
    String s = "test if #hash has been removed";
    TokenStream stream = analyzer.tokenStream("field", new StringReader(s));
    stream.reset();
    CharTermAttribute termAtt = stream.addAttribute(CharTermAttribute.class);
    while (stream.incrementToken()) {
        System.out.println(termAtt.toString());
    }
    stream.end();
    stream.close();
}
印刷品

测试
散列

一直以来
除去