2

I am making a .NET desktop application (WinForms+Local PostgreSQL Server) for managing sales in a small store.

I wish to integrate Lucene search facilities into the 'Product Search' module of my software. Are there any good patterns for integrating such Information Retrieval Libraries into existing applications?

Note : The application is still in development and I can always modify the architecture to integrate Lucene.

Note : I know how to use Lucene and have created a simple demo app to test it's capabilities. I am only looking for patterns that integrate such search functionality into Desktop Applications.

Note : Also the main requirement of the integration is to enable the user to quickly search for products/brands/etc and provide a google autocomplete'esque system in the UI.

4

2 回答 2

3

I would recommend in getting the book "Lucene in Action". It is based on the Lucene 3.0.3 version for Java, HOWEVER that version happens to be the most current version for .NET (3.0.3).

That book will provide you with all you need to get going for .NET. Implementing a "Google-like" search is actually not that trivial..having to do: fuzzy searches, thesaurus matching, spelling/did you mean, complex scoring etc. I have been using Lucene for over 3 years and that book has helped me learn a lot.

于 2013-08-13T02:05:46.123 回答
2

就个人而言,我创建了一个通用存储库,它在某些时候为您提供了某种程度的抽象,还有一个名为linq to lucene的项目与存储库模式完美匹配,我已经获取了部分代码并制作了自己的实现根据我的需要,我建议你看一下,还有一个名为lucene contrib的 nuget 包,它为 lucene.net 添加了更多功能。包裹。

在你的 lucene 实现中使用 linq 的好处是,任何 avg 开发人员都可以在没有深入了解 lucene 的情况下进行文本搜索。

总是建议在谈论架构时考虑诸如 DRY、SOLID、TDD 之类的 OOP 原则。就我而言,我有一个单独的项目,例如 companyName.Software.Lucene,它抽象了 lucene 背后的所有机制,当您使用该实现时,感觉就像您在某些时候使用 ORM 进行搜索。

在您使用 nHibernate 的情况下,可以选择使用设置的文本索引

于 2013-08-12T14:31:26.930 回答