如何在 SQL Server 中搜索 varbinary 字段? [英] How to search a varbinary field in SQL Server?

查看:62
本文介绍了如何在 SQL Server 中搜索 varbinary 字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,允许用户上传文件,主要是 PDF 和 Word 文档.这些文件存储在数据库的 varbinary 字段中.就其价值而言,无论用户如何通过 Web 或 Windows 窗体应用程序或任何其他表示层访问应用程序,我都需要让这些文件可用.

I have an application where I allow users to upload files, mainly PDF and Word documents. These files are stored in a varbinary field in the database. For what it is worth, I need to have these files available regardless of how the user is accessing the application, via Web or Windows Forms application or any other Presentation layer.

有没有办法搜索这些字段的原始文本内容?例如,如果我上传一份简历,我希望用户能够搜索 C# 并能够在 varbinary 字段的内容中查找指定文本.

Is there a way to search the raw text contents of these fields? For example, if I upload a resume, I would like the user to be able to search C# and be able to look in the contents of varbinary field for the specified text.

另外,如果有更好的策略来处理这个问题,我愿意接受.

Also, if there is a better strategy for handling this, I am open to it.

推荐答案

我会说使用 SQL Server 是错误的工作工具(搜索方式),因为它无法本地解析存储在二进制文件中的文本文档.

I would say that using SQL Server is the wrong tool for the job (search-wise) as it can't natively parse through the text stored in a binary document.

我建议查看类似 Lucene.NET(.NET 端口Lucene 搜索引擎...最初是用 Java 编写的),可让您在上传文档后轻松搜索.

I suggest looking in to something like Lucene.NET (the .NET port of the Lucene Search Engine...originally written in Java) which will allow you to easily search through your documents after they've been uploaded.

您应该能够构建一个解决方案,允许您将文档存储保留在 SQL Server 中,但使用 Lucene.NET 来索引和搜索您存储在那里的文档.

You should be able to architect a solution that allows you to retain your document storage in SQL Server but use Lucene.NET to index and search the documents that you have stored there.

这篇关于如何在 SQL Server 中搜索 varbinary 字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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