使用 asp.net 进行全文索引和参数化查询
我有一个内部构建的查询生成器,它使用全文索引来执行描述搜索。
查询已构建并参数化,我想知道从网站对表单字段进行编码的最佳方法,以便传递搜索字符串,例如:
- 覆盖
- 由“红色”靠近“黄色”
- 红色“鱼
”谢谢
I've got a query builder that's been built in house which is using a full text index in order to perform description searches.
The query is built and parametrized and I was wondering the best way to encode the form field from the website in order to pass search strings such as:
- Covered by
- "red" near "yellow"
- red" fish
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想使用全文搜索,您应该将 where 子句与其他特定函数(不仅仅是 = 或 like )一起使用。
@param1 仍然是一个字符串(最终是 nvarchar);请参阅此处:
使用全文搜索查询 SQL Server
例如,你以这种方式查询(来自MSDN):
关于特殊字符和转义它们,只需看看这里:SQL Server 全文搜索转义字符?
If you want to use full text search you should use where clause with other specific functions ( not just = or like ).
@param1 will still be a string (nvarchar eventually); see here:
Querying SQL Server Using Full-Text Search
for example, you query in this way (from MSDN):
about special chars and escaping them, just have a look here: SQL Server Full Text Search Escape Characters?