如何在代码项目中使用与文章搜索相同的运算符来实现搜索 [英] how to implement search using operators same as article search in code project

查看:80
本文介绍了如何在代码项目中使用与文章搜索相同的运算符来实现搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要使用类似于代码项目文章搜索[AND OR NOT()]的运算符来实现搜索.我正在处理具有名称和国家/地区以及一些与个人相关的信息的数据库.用户可以从前端搜索页面中使用"Andrew AND US","Bruce NOT INDIA",(Jaime AND UK)或(Jaime AND US)"等条件进行搜索.
请为此提出建议和最佳方法.

谢谢,
Kiran

Hi

I need to implement search using operators similar to code project article search [AND OR NOT ( )]. I am dealing with database having names and countries and some information related to individuals. User can search with criteria like "Andrew AND US", "Bruce NOT INDIA", "(Jaime AND UK) OR (Jaime AND US)" from front end search page.
Please suggest possibilities and best approaches for this.

Thanks,
Kiran

推荐答案

您可能已经猜到了,您将不得不在这里进行大量的标记化.您要做的是解析文本以查找常用运算符,确保它们不在引号内.您最终想要得到的是一棵树,该树代表您将要执行的搜索,并使用该树来创建实际的搜索.
As you''ve probably guessed, you are going to have to do a fair bit of tokenising here. What you are going to have to do is parse out the text looking for the common operators, making sure that they are outside of quotes. What you ultimately want to end up with is a tree that represents the search that you are going to perform, and use that to create the actual search.


使用cotain/freetext/containtable/freetexttable从全文搜索查询以搜索此内容.获得更多帮助,请转至Google搜索全文搜索,您将找到解决方案.

http://msdn.microsoft.com/en-us/library/ms142571.aspx [ ^ ]

http://msdn.microsoft.com/en-us/library/ms177652.aspx [ ^ ]


在这里,您必须使用而不是"代替"not",其他布尔型词仍与往常一样.
use cotain/freetext/containtable/freetexttable query from fulltext search to search this.for more help goto google search this full text serach you you will find solution .

http://msdn.microsoft.com/en-us/library/ms142571.aspx[^]

http://msdn.microsoft.com/en-us/library/ms177652.aspx[^]


here you have to use "and not" in place of not, other boolean words are as usual.


这篇关于如何在代码项目中使用与文章搜索相同的运算符来实现搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆