Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would be the motivation to integrate mongodb with solr [closed]

Mongodb is a nosql db and any query can be run on it except full text search since it reduces the overall performance. Solr is a search engine to search. When we integrate these two together then dont we have the same data in both systems? So if we already going to store the data anyway why we dont store it directly in solr and lucene. Btw i am not sure when if solr stores only index or together with data.

like image 783
fatih tekin Avatar asked Apr 25 '14 11:04

fatih tekin


People also ask

Why do we use SOLR?

Solr is a search server built on top of Apache Lucene, an open source, Java-based, information retrieval library. It is designed to drive powerful document retrieval applications - wherever you need to serve data to users based on their queries, Solr can work for you.

Can you use SOLR as a database?

Solr, however, is more than a search engine — it's also often used as a document-based NoSQL database with transactional support that can be used for storage purposes and even a key-value store.

Does MongoDB use Lucene?

Amazon and MongoDB both use Lucene every day, and the most important use case is no doubt application search, in which the engine is primarily used by humans.


2 Answers

ok now i know the reason since only the fields we have configured in Solr will be stored in lucene we are not storing the whole data in lucene also. We only store the the search criteria fields in lucene. They are more like completing each other. To explain with an example lets say i have a document having 40 fields and 5 of them are another documents. Imagine I want to make a query saying that i want 3 specific field in document to be equal to a certain value and in one of the child document of parent table i have another criteria for a specific field to be in an interval and 1 another to include certain word. For that rather then having extra indexes in mongodb, I can store only these fields in solr by configuring solr properly.

like image 172
fatih tekin Avatar answered Oct 20 '22 19:10

fatih tekin


I might be late to the party but here is my reason why I have started using solr with mongo.
Reason being, I store nested data in mongodb hence the queries are too slow even after indexing as per guide from mongodb. Hence now we started using solr for search, mongodb to store data and another collection in solr for some ranking based search.

We do not store full data in solr for search just filter fields and ID and we leverage redis as cache to get data by ID.

like image 42
Mukesh Yadav Avatar answered Oct 20 '22 18:10

Mukesh Yadav