以小写形式搜索
我有一个两步搜索问题。首先,我想查看是否有与确切的搜索短语匹配的内容 - 然后在步骤 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了使用自定义分词器/分析器的解决方案。它并不完全理想,但它应该仍然有效。
I've found a solution using a custom tokenizer/analzyer. It isn't exactly ideal, but it should still work.