搜索词开头的通配符 -Lucene
据我所知 lucene(.net) 不支持搜索词开头的通配符 --> http://lucene.apache.org/java/2_0_0/queryparsersyntax.html “注意:您不能使用 * 或 ? 符号作为搜索的第一个字符。”
例如 *myword
也许是因为在搜索词之前搜索“所有内容”非常困难。
尽管如此,我们还是在寻找一种在一开始就使用通配符的方法。 有谁知道这是否可能?
一个想法是 asearchterm、bsearchterm、...z*searchterm ...但这对我来说似乎有点随机。
提前致谢
As far as i know lucene(.net) doesn't support the wildcard at the beginning of a searchterm
--> http://lucene.apache.org/java/2_0_0/queryparsersyntax.html
"Note: You cannot use a * or ? symbol as the first character of a search."
for example
*myword
maybe because it's quiet difficult to search "everything" before the searchterm.
Despite that, We are looknig for a way to use the wildcard at the beginning.
Does anyone know if this is possible?
One Thought was asearchterm, bsearchterm, ....z*searchterm
... but that seems a bit random to me.
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题被标记为 Lucene.NET,所以我假设您指的是 .NET 版本而不是 Java 版本。
是的,您可以在搜索词的开头使用 via 通配符,
但您需要注意性能后果。在此博客中查找更详细的源代码。
由于 Lucene.NET 是 Java 版本的移植,我怀疑您可以对 Java 版本使用相同的方法。不过我没有验证这一点。
Your question is tagged with Lucene.NET so I assume you mean the .NET version rather than the Java version.
Yes, you can have wildcards at the beginning of a search term by via
but you need to be aware of the performance consequences. Find more detailed source code in this blog.
Since Lucene.NET is a port of the Java version, I suspect you could use the same approach for the Java version. I didn't verify this, though.