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

查看:63
本文介绍了领先的通配符在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?

推荐答案

设置

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天全站免登陆