LinqToLucene和Lucene.Net.Linq之间的区别 [英] difference between LinqToLucene and Lucene.Net.Linq

查看:104
本文介绍了LinqToLucene和Lucene.Net.Linq之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. LinqToLucene Lucene.Net.Linq 项目不同吗?
  2. 它们各自的优缺点是什么?
  3. 因为我发现Lucene.Net.Linq相对于LinqToLucene进行了更新,并且可以在nuget中获得,所以我想在我的简单项目中使用它, 但是我遇到了缺少文档的问题,找不到我该怎么办 在此程序包中使用lucene高级查询,例如可能的操作 例如在LinqToLucene中:

  1. Are the LinqToLucene and the Lucene.Net.Linq projects different?
  2. What are the pros and cons of each of them?
  3. Since I found Lucene.Net.Linq to be updated more recently relative to LinqToLucene and it is available in nuget I want to use it in my simple project, but I came across lack of documentation and I can't find how can I use lucene advanced queries with this package like what are possible in LinqToLucene for example:

var query = from c in index.Customers
            where c.Like("amber") || c.CompanyName.Between("a", "d")
            where !c.CustomerId == "Jason"

如果此扩展功能不可用,那么该项目的目的是什么?

If this extension functions aren't available then what is the point of this project?

推荐答案

对Lucene的LINQ似乎无效.撰写本文时的最后一次提交是在2012年10月,而有关该项目是否处于活动状态的最后一个讨论帖子自同一时间段以来一直未得到答复.

LINQ to Lucene appears to be inactive. The last commit at time of writing was in October 2012 and the last discussion post asking if the project is active has gone unanswered since the same time frame.

LINQ to Lucene与Entity Framework紧密相连,因此在我看来,该项目旨在对来自EF的数据进行索引以进行自由文本搜索.

LINQ to Lucene has some tight coupling to Entity Framework so it seems to me the project is designed to index data coming from EF for free text search.

Lucene.Net.Linq是一个完全独立的项目,我于2012年启动并一直积极维护.该项目与EF或其他库没有任何耦合.它仅依赖于Lucene.Net,Common.Logging进行日志记录,并依赖Remotion.Linq进行LINQ查询解析和翻译.我最初评估了对LINQ贡献给Lucene的可能性,但是发现与EF的紧密耦合以及其他一些假设使该库不适合我的需求.

Lucene.Net.Linq is a completely separate project that I started in 2012 and have been actively maintaining. This project does not have any coupling to EF or other libraries. It only depends on Lucene.Net, Common.Logging for logging, and Remotion.Linq for helping with LINQ query parsing and translation. I originally evaluated the possibility of contributing to LINQ to Lucene, but found that the tight coupling to EF and some other assumptions made the library inappropriate for my needs.

  1. 在NuGet上不可用
  2. 未积极维护
  3. 非常受限在您可以放入where子句
  4. 是否要使用EF
  1. Not available on NuGet
  2. Not actively maintained
  3. Very limited in what you can put into a where clause
  4. Coupled to EF whether you want it or not

Lucene.Net.Linq的优点:

  1. 积极维护
  2. 发布到NuGet的包装(和符号!)
  3. 更好地理解复杂查询
  4. 流利和属性API,用于将属性映射到字段并控制分析,存储和索引

Lucene.Net.Linq缺点:

  1. 文档可能会更好
  2. 只有少数几个我自己的贡献
  3. 与原始Lucene.Net相比,性能不清楚(未进行太多性能测试)

该文档由项目README和样品代码.

The documentation, such that it is, consists of the project README and sample code in the unit test project.

Lucene.Net.Linq没有Lucene.Net本地支持的每个查询的扩展方法.但是,它确实提供了一个逃生舱口,您可以在其中传递自己的Query:

Lucene.Net.Linq does not have extension methods for every query that Lucene.Net supports natively. However, it does provide an escape hatch where you can pass in your own Query:

var result = customers
            .Where(new TermRangeQuery("CompanyName", "A", "C", includeLower: true, includeUpper: true))
            .ToList();

它支持搜索具有模糊匹配的任何索引字段:

And it supports searching any indexed field with fuzzy match:

var result = customers
            .Where(c => (c.AnyField() == "amber").Fuzzy(1.0f))
            .ToList();

它支持与==!=的简单匹配:

And it supports simple matching with == and !=:

var result = customers
            .Where(c => c.CustomerId != "Jason")
            .ToList();

请注意,==的含义由给定字段的索引方式控制.如果将该字段索引为关键字,则精确匹配生效.如果该字段被标记化,词干化,转换为小写字母等,则==将匹配该字段中的任何术语.

Note that the meaning of == is controlled by how a given field is indexed. If the field is indexed as a keyword, exact matching takes effect. If the field is tokenized, stemmed, converted to lowercase, etc, then == would match any term in the field.

这篇关于LinqToLucene和Lucene.Net.Linq之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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