搜索 Elmah AllXml 字段
我想在Elmah错误的任何字段上实现搜索功能,除了在AllXml字段上使用全文搜索(设置相对困难)之外,有什么方法可以让搜索更快?我的网站流量很大,每分钟会产生很多错误。
ps,如果我使用全文搜索,我看到有很多新的错误产生,我能及时搜索到新的错误吗?
I want to implement a search function on any field of Elmah errors, beside using full text search on AllXml field(it is relative difficult to setup), is there any way to let the search fast? My site has a lot of traffic, and generat a lot of errors per minute.
ps, if I use full text search, as I see there are a lot of new errors generated, can I searched new errors in time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几乎可以肯定,全文搜索将是搜索数据的最快方式,特别是因为 Elmah 将 XML 存储在
ntext
字段中。您唯一的其他选择是使用LIKE
进行文本搜索(比全文更慢且更受限制),或者每隔一段时间将ntext
字段转换为 xml 数据类型您需要进行搜索的时间。根据您要搜索的错误数量,这可能是一个成本非常高的过程。全文解决方案的唯一缺点是,如果搜索词与 XML 项的定义匹配(例如搜索单词“item”或“value”),您将面临误报的风险。至于您是否能够实时搜索错误的问题,这取决于您的数据库平台。可以通过多种方式配置 SQL Server,为您提供近乎实时的全文搜索功能(请参阅 http://technet.microsoft.com/en-us/library/ms142575.aspx)。
It's almost guaranteed that full-text searching is going to be the fastest way to search the data, especially since Elmah stores the XML in an
ntext
field. Your only other option would be to do a text search usingLIKE
(slower and more limited than full-text), or to convert thentext
field into an xml data type every time you need to do a search. Depending on the number of errors you're searching over, that could be a very costly process.The only downside to a full-text solution is that you run the risk of false positives if the search term matches to an XML item's definition (such as searching on the word "item" or "value"). As to your question about whether you'd be able to search errors in real-time, that would depend on your database platform. SQL Server can be configured in a number of ways to give you nearly real-time full text searching capabilities (see http://technet.microsoft.com/en-us/library/ms142575.aspx).