Lucene query: bla~* (match words that start with something fuzzy), how?

前端 未结 4 1396
旧时难觅i
旧时难觅i 2020-12-05 15:59

In the Lucene query syntax I\'d like to combine * and ~ in a valid query similar to: bla~* //invalid query

Meaning: Please match words that begin with \"bla\" or so

4条回答
  •  暖寄归人
    2020-12-05 16:37

    You mean you wish to combine a wildcard and fuzzy query? You could use a boolean query with an OR condition to combine, for example:

    BooleanQuery bq = new BooleanQuery();
    
    Query q1 = //here goes your wildcard query
    bq.Add(q1, BooleanClause...)
    
    Query q2 = //here goes your fuzzy query
    bq.Add(q2, BooleanClause...)
    

提交回复
热议问题