admin管理员组

文章数量:1355542

Question: I am working on a search functionality using Lucene.NET with the StandardAnalyzer, and I noticed an issue with wildcard queries not matching expected results.

Issue: My indexed field contains values like: 24-PC-QMR-NB-3

Since StandardAnalyzer tokenizes the text by splitting on hyphens (-), the stored tokens become:

["24", "pc", "qmr", "nb", "3"] When I run a normal search query like 24-PC-QMR-NB-3, Lucene correctly finds the document.

However, when using a wildcard query like 24-PC-QMR-NB-3*, it does not return any results.

Question: Why does StandardAnalyzer prevent wildcard queries from matching tokenized fields?

How can I modify my indexing or querying approach to allow wildcard searches on fields containing spaces or special characters?

本文标签: