如何使用 lucene.net 索引文件夹

发布于 2024-10-07 09:51:30 字数 335 浏览 0 评论 0原文

我正在尝试使用 lucene.net 在 asp.net 中开发一个搜索引擎。我浏览了许多教程和页面以获得适当的结果,但我做不到。 实际上,我有一个包含一些文件(doc、ppt、pdf、excel 等)的文件夹,我只想在该文件夹中搜索内容,如果在该文件夹中找不到结果,则要求用户在网络上搜索。

例如我有一个包含数千个文件的文件夹@ C:\test 如果用户搜索“miller”,那么它应该搜索每个文档。如果找到结果,那么它应该显示类似

搜索文本文件没有出现的 结果 米勒 C:\test\1\file.doc 5 miller C:\test\1\11\new.doc 2

请帮助我,我没有得到适当的结果。

I am trying to develop a search engine in asp.net using lucene.net. I go through many tutorials and pages to get the appropriate results but i couldn't.
Actually I have a folder with some files(doc,ppt,pdf,excel etc..) and i want to search within that folder only for contents and if the results are not found within that folder then ask user to search on web.

for example i have a folder with thousands of files @ C:\test
and if user searched for "miller" then it should search into every document. if results are found then it should display results like that

Searched text file no of occurences
miller C:\test\1\file.doc 5
miller C:\test\1\11\new.doc 2

please help me i am not getting appropriate results .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟酒忠诚 2024-10-14 09:51:30

Lucene / Lucene.NET 只是一个索引引擎,您仍然必须从您想要支持自己的文件类型中提取文本 - 在 Windows 上您可以使用 IFilter 接口适用于多种文件类型,如果您安装了 Acrobat Reader 7+,则应该内置支持用于 PDF 文件的 IFilter。至于索引部分本身,有很多很多示例。

另请参阅此线程 使用 C# 或经典 ASP (VBScript) 从 PDF 中提取文本的好方法是什么?

Lucene / Lucene.NET is just an indexing engine, you still have to extract the text from the file types that you want to support yourself -on Windows you can use the IFilter interface for many file types, if you have Acrobat Reader 7+ installed there should be built in support for IFilter for PDF files. As for the indexing part itself there are many, many samples out there.

Also see this thread What's a good method for extracting text from a PDF using C# or classic ASP (VBScript)?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文