0

我有许多 word 和 excel 文件,我想在这些文件的内容中搜索指定的词(用户将其作为参数提供给我的应用程序)。那我该怎么做呢?我想用 C# 做这项工作,我可以做吗?

我的文件内容是波斯语。

事实上,我想用这些文件做一个搜索引擎。

谢谢。

4

1 回答 1

2

查看 Lucene 引擎或实施 yourslef Inveted Index

5 分钟内来自lucene 的示例(仅更改为“PersianAnalyzer”)

StandardAnalyzer analyzer = new PersianAnalyzer(Version.LUCENE_40);
Directory index = new RAMDirectory();

IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);

IndexWriter w = new IndexWriter(index, config);
addDoc(w, "Lucene in Action", "193398817");
addDoc(w, "Lucene for Dummies", "55320055Z");
addDoc(w, "Managing Gigabytes", "55063554A");
addDoc(w, "The Art of Computer Science", "9900333X");
w.close()
于 2013-02-04T14:17:23.183 回答