Lucene.net 获取包含匹配项的整个 csv 行

发布于 2024-10-09 13:25:22 字数 157 浏览 0 评论 0原文

我需要在巨大的 csv 文件中搜索一个术语(或更多术语)。 我发现 Lucene.Net 是对其进行快速查询的最佳方式。

好吧,我可以创建索引并进行查询,但我无法获取包含匹配项的整个行。

我正在尝试使用荧光笔类,但我需要切割正确行周围的字符串,我认为这不是最好的方法。

I need to search a term (or more terms) inside huge csv files.
I foud Lucene.Net as the best way to make a fast query on them.

Well, l'm able to create an index and make queries but I cant get the entire rows that contains the match.

I'm trying with the highlighter class, but I need to cut the string around the correct row and I think this is not the best way..

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

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

发布评论

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

评论(1

明天过后 2024-10-16 13:25:22

您应该将每一行放入索引中的单个文档中(例如,在 "csv_row" 字段中),然后通过搜索结果中的 doc.Get("csv_row") 访问它文件。

PS Lucene 确实是在大型文本文件中搜索的正确方法,比数据库快得多。

You should put each row in an individual Document on indexing (say, in "csv_row" field), then access it via doc.Get("csv_row") in search result documents.

P.S. Lucene is really the right way to search within huge text files, much faster than the database.

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