How to Instantly Index a Node to Apache?
Have you been trying to index your node to Apache immediately after its been created, updated or deleted! Read On!!
By default Apache Solr uses a queue system to index data to Solr. We can preconfigure the interval in which the indexing should perform. Still, there occurs a delay for the node to get indexed.
There exists a module which does our job of instantly indexing the nodes to Apache. The module Apache Solr Real-Time implements real-time commits of Drupal entities with the Apache Solr Search Integration project, removing the delay between making a change on your site, and that change becoming visible in Solr search results.
This module uses Soft Commit for Solr version above 4.x thus minimizing Solr server resources.
Also, this module uses hook_entity_update, hook_entity_delete to update the current entity to Solr.
Unfortunately this module only supports the entity "node". For instantly indexing your custom entities you can use the above hooks and use the apachesolr_index_entity_to_documents function, which is provided by Apache Solr to index the current entity to Solr.
Happy Coding!