前导通配符在 Lucene.NET 中引发错误 [英] Leading wildcard character throws error in Lucene.NET

查看:19
本文介绍了前导通配符在 Lucene.NET 中引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果搜索查询包含前导通配符(*?),则 QueryParserParse 函数抛出错误.

If the search query contains a leading wildcard character (* or ?), the QueryParser's Parse function throws an error.

Dim q As String = "*abc"
Dim qp As New QueryParser("text", New StandardAnalyzer())
Dim query As Query = qp.Parse(q)

在 Lucene.NET v2.0.0.4 中有没有办法解决这个问题?

Is there any way to solve this problem in Lucene.NET v2.0.0.4?

推荐答案

设置 QueryParser.SetAllowLeadingWildcard 方法 为真.API 页面指出这可能会在大索引上产生非常慢的查询".

Set QueryParser.SetAllowLeadingWildcard Method to true. The API page states that "this can produce very slow queries on big indexes" though.

这篇关于前导通配符在 Lucene.NET 中引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆