Motor de búsqueda Lucene vs búsqueda de base de datos

I am using a MySQL database and have been using database driven search. Any advantages and disadvantages of database engines and Lucene search engine? I would like to have suggestions about when and where to use them?

preguntado el 09 de enero de 11 a las 10:01

4 Respuestas

Te sugiero que leas Full Text Search Engines vs. DBMS. A one-liner would be: If the bulk of your use case is full text search, use Lucene. If the bulk of your use case is joins and other relational operations, use a database. You may use a hybrid solution for a more complicated use case.

Respondido 20 Feb 17, 16:02

i have seen 'search our site' in lots of sites. If I am to search the content of sites, then which would be better? - Santosh Linkha

Searching a site is full-text search. Therefore, Lucene is better. Better still, use Solr: lucene.apache.org/solr - Yuval F

@YuvalF if the database is not large and the user of that site is not so many, is DBMS based full text query enough? since sometimes if that guy want to use lucene, he must develop it by himself ... - enorme miau

@hugemeow - sure. A DBMS's full-text search will be fine for small use cases. If you want to use Lucene, you can use Solr or ElasticSearch - both much easier to start working with than bare Lucene, and providing at least 90% of Lucene's functionality. I have also heard nice things about Sphinx, though have never used it myself. - Yuval F

I have updated the link. Also see my Quora answer about a related subject, where I have added the NoSql option: quora.com/ElasticSearch/… - Yuval F

Use Lucene when you want to index textual Documentos (of any length) and search for Texto within those documents, returning a ranked list of documents that matched the search query. The classic example is search engines, like Google, that uses text indexers like Lucene to index and query the content of web pages.

The advantages of using Lucene over a database like Mysql, for indexing and searching text are:

  • para el desarrollador - tools to analyse, parse and index textual information (e.g. stemming, plurals, synonyms, tokenisation) in multiple languages. Lucene also scales very well for text search.
  • para el usuario - quality search results. Lucene uses a very good similarity function (to compare the search query against each document), at the heart of which are the Cosine Similarity and Inverse Term/Document frequency. This results in good search results with very little tweaking required upfront.

Mucho useful info on Lucene here.

Respondido el 09 de enero de 11 a las 18:01

is there any more advantageous alternative to Lucene . Opensource or proprietor (Paid or REST API) - Ravinder Payal

@RavinderPayal Most open source search engines are built on top of Lucene - e.g. Solr and Elasticsearch. If you don't have a need to store billions of documents and want something that's fast and simple, take a look at something like Typesense: github.com/typesense/typesense - Jeffreyveon

@jeffreyveon type-sense seems reasonable, will dig more in depth - Ravinder Payal

We used Sql Server at work to make some queries which used Fulltext search. In case of big amounts of data Sql makes an inner join between result set returned by FullText search and the rest of the query which might be slow if database is running on the low powered machine (2GB ram for 20 GB of data). Switching the same query to Lucene improved speed considerably.

Respondido 21 Feb 11, 16:02

Lucene search has a advantage of indexing. Esta historia de post can help you understand lucene.

contestado el 23 de mayo de 17 a las 14:05

i think we can also add index on database table. but i don't have a clue about what is it? - Santosh Linkha

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.