Indexing Data directly from database Solr 6.5 - database

I'm new to new Solr. I got the examples of how to index data directly from database for Solr 4.9 but still not able to find anything for Solr 6.5.
Does Solr 6.5 support database indexing? If yes, then how to achieve same.

DataImportHandler is usually the way to load data from a database into Solr. It was there in Solr 4.9 and is still there in Solr 6.5.
Specifically, Solr ships with a dih example (bin/solr start -e dih) that has a number of collection, one of them showing database indexing.
There are also third party products that can read from database and index into Solr (eg. Apache NiFi), but their levels of Solr support may vary.

Related

Replicate aws cloudsearch data into apache solr

Is there any way to replicate replicate file index data which is aws cloudsearch to apache solr hosted on ec2 real time.
Not really- in order to make sure that all of your original documents are indexed correctly you have to reindex them into Solr in their original form.

Solr export / replication to a database

My current application has a Solr engine for storing large amounts of data, however I would like to have some of this data copied over to a PostGres database.
Ideally this "replication" should have a delta comparation mechanism for not missing any data coming from Solr.
I can see lots of examples for importing the data from a database into Solr (DataImportHanlder) but not the other way around, I cannot find any DataExportHandler in the Solr Documentation.
Any suggestions?
Thanks

Switch between Solr and DB for Query Execution alfresco cmis

Using Alfresco Community - 5.0.0 version.
Tried below properties in alfresco-global.properties file:
queryConsistency=EVENTUAL then all queries are going to Solr.
queryConsistency=TRANSACTIONAL then all queries are going to DB.
And Default mode executes all queries from DB first then Solr in case of failure from DB.
Q1: Is there any mode by which I can query Solr first and if there are no results from Solr then query DB in one transaction?
Q2: Can we execute some queries from Solr and some from DB from JAVA side?
Alfresco calls this a Transactional Metadata Query, where the query can fall back to the database when Solr returns no results.
Details on configuring this behavior can be found here, but basically queryConsistency should be set to TRANSACTIONAL_IF_POSSIBLE.
It's important to note, especially if you're converting Lucene queries to CMIS, that certain query parameters (e.g., +PATH:) and wildcards (e.g., #docs:pageId:homepage) require Solr to function, and cannot refer to the database directly in the event of a Solr failure. You can test whether a given parameter requires Solr in Alfresco under Admin Tools / Node Browser. Run your query selecting different types; type: solr-fts-alfresco is Solr-only; type: db-afts to query Solr first and fallback to the database if Solr returns nothing.
And to answer your second question, the second link above mentions:
The solr.query.cmis.queryConsistency and solr.query.fts.queryConsistency properties can also be set per query on the SearchParameters and QueryOptions objects.
So it seems you can accomplish what you want within your Java code, but I have not tried this myself. I find it most desirable, as a general rule, to hit Solr first for its performance gains then fallback to the database only if necessary. I can't think of a good case for embedding the data source selection within your business logic.

Mahout lucene/solr compatibility

I'm trying to use Mahout clustering to cluster my solr index. I am using Solr 5.5 and latest Mahout version only supports 4.6.1 lucene indexes therefore I'm getting the following error
Exception in thread "main"rg.apache.lucene.index.IndexFormatTooNewException: Format version is not supported
So my question is can someone help me with how to safely update lucene version that is being used by mahout

How to connect Solr 4.4.0 to java application i have created and search data?

I am new user to solr,I want to access and search the MYSQL database tables in java applications via solr.i am able to index my table in solr admin interface. Can anyone tell me how to connect and access MYSQL tables in java application so that i can search data fastly ? I was not able to understand tutorials whatever i found.
Solr provides client libraries in java, ruby and other languagues to help you connect to Solr and query it.
Check for the Java library Solrj to connect and query Solr.
If you are using Frameworks with your projects you might want to check for Spring data as well which will help you seamlessly query and transform Solr response.
So you will need to set up an instance of a Solr Server, SOlr will store and indexes from your database using the DataImportHandler.
http://amac4.blogspot.co.uk/2013/08/configuring-solr-4-data-import-handler.html
Solr creates indexes using Lucene, so you have two options, you can use classes from the Lucene jar file or SolrJ to search your indexes.
OR
You can query Solr by sending http requests. I set-up a Java Web Service so you can snatch some of my code if you need to.
http://amac4.blogspot.co.uk/2013/07/restful-java-web-service-for-solr.html

Resources