1. 程式人生 > >Lucene 和solr的區別

Lucene 和solr的區別

solr和lucene的區別:

A simple way to conceptualize the relationship between Solr and Lucene is that of a car and its engine. You can't drive an engine, but you can drive a car. Similarly, Lucene is a programmatic library which you can't use as-is, whereas Solr is a complete application which you can use out-of-box.

Lucene是一個開放原始碼的全文檢索引擎工具包,即它不是一個完整的全文檢索引擎,而是一個全文檢索引擎的架構,提供了完整的查詢引擎和索引引擎,部分文字分析引擎(英文與德文兩種西方語言)。Lucene的目的是為軟體開發人員提供一個簡單易用的工具包,以方便的在目標系統中實現全文檢索的功能,或者是以此為基礎建立起完整的全文檢索引擎.

Solr是一個高效能,採用Java5開發,基於Lucene的全文搜尋伺服器。同時對其進行了擴充套件,提供了比Lucene更為豐富的查詢語言,同時實現了可配置、可擴充套件並對查詢效能進行了優化,並且提供了一個完善的功能管理介面,是一款非常優秀的全文搜尋引擎。它對外提供類似於Web-service的API介面。使用者可以通過
http請求
,向搜尋引擎伺服器提交一定格式的XML檔案,生成索引;也可以通過Http Solr Get操作提出查詢請求,並得到XML格式的返回結果;
Solr和Lucene的本質區別有以下三點:搜尋伺服器,企業級和管理。Lucene本質上是搜尋庫,不是獨立的應用程式,而Solr是。Lucene專注於搜尋底層的建設,而Solr專注於企業應用。Lucene不負責支撐搜尋服務所必須的管理,而Solr負責。所以說,一句話概括Solr: Solr是Lucene面向企業搜尋應用的擴充套件。

What is Solr?

Apache Solr is a web application built around Lucene with all kinds of goodies.

It adds functionality like

  • XML/HTTP and JSON APIs
  • Hit highlighting
  • Faceted Search and Filtering
  • Geospatial Search
  • Fast Incremental Updates and Index Replication
  • Caching
  • Replication
  • Web administration interface etc

Unlike Lucene, Solr is a web application (WAR) which can be deployed in any servlet container, e.g. Jetty, Tomcat, Resin, etc.

Solr can be installed and used by non-programmers. Lucene cannot.

Is it well supported?

Yes! The Solr community is very vibrant and helpful.

Can Solr indexes be read by Lucene and vice-versa?

Since Solr uses Lucene under the hood, Solr indexes and Lucene indexes are one and the same thing.

There is technically no such thing as a Solr index, only a Lucene index created by a Solr instance.

When should I use Lucene then?

If you need to embed search functionality into a desktop application for example, Lucene is the more appropriate choice.

For situations where you have very customized requirements requiring low-level access to the Lucene API classes, Solr may be more a hindrance than a help, since it is an extra layer of indirection.