以小写形式搜索

发布于 2024-12-03 06:29:27 字数 467 浏览 2 评论 0原文

我有一个两步搜索问题。首先,我想查看是否有与确切的搜索短语匹配的内容 - 然后在步骤 2 中对多个属性进行通用全文搜索。

我已将属性映射如下:

[Field(Name = "CompanyNameFull",Index = Index.UnTokenized)]
[Field]
public string CompanyName { get; private set; }

我的问题是我的用户通常以小写形式搜索 - 并且公司名称通常采用正确的大小写。因此,“ibm*”找不到“IBM International”,但“IBM*”可以找到,而“ital*”则找不到“Italian Furniture”,而“Ital*”则可以。

我徒劳地尝试在属性中附加一个分析器以在索引时强制其为小写 - 但这失败了,因为分析器仅在它是标记化属性时才附加(据我所知)。我尝试了各种查询替代方案也无济于事。

我缺少什么?

I have a two-step search problem. First I want to see if any matches with the exact search-phrase - and then in step 2 take the generic full-text search across a number of properties.

I have mapped the property as follows:

[Field(Name = "CompanyNameFull",Index = Index.UnTokenized)]
[Field]
public string CompanyName { get; private set; }

My problem is that my users usually search in lowercase - and the company name is usually in proper case. So, "ibm*" doesn't find "IBM International", but "IBM*" does - and "ital*" doesn't find "Italian Furniture" while "Ital*" does.

I've tried in vain to attach an analyzer in the attribute to force it to be lowercase when indexed - but this fails, as the analyzer is only attached if it is a tokenized property (as far as I can tell). I've tried various querying alternatives to no avail either.

What am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

_失温 2024-12-10 06:29:27

我找到了使用自定义分词器/分析器的解决方案。它并不完全理想,但它应该仍然有效。

I've found a solution using a custom tokenizer/analzyer. It isn't exactly ideal, but it should still work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文