php - Solr search engine need to restart after adding docs -


i working solr 6.6.0 using solr php client. adding docs using below code , working :

foreach ($data $key => $value) {                  $docs['doc_no'.$i]['id'] = $value['id'];                 $docs['doc_no'.$i]['name'] = $value['name'];                 $docs['doc_no'.$i]['sub_title'] = strip_tags($value['sub_title']);                 $docs['doc_no'.$i]['small_image'] = $value['small_image'];                 $docs['doc_no'.$i]['project_type'] = $value['project_type'];                 $docs['doc_no'.$i]['project_status'] = $value['project_status'];                 $docs['doc_no'.$i]['logo'] = $value['logo'];                 $docs['doc_no'.$i]['price'] = $value['price'];                 $docs['doc_no'.$i]['url'] = $value['url'];                 $docs['doc_no'.$i]['flat_type_desc'] = $value['flat_type_desc'];                 $docs['doc_no'.$i]['project_config'] = $value['project_config'];                 $docs['doc_no'.$i]['address'] = $value['address'];                 $docs['doc_no'.$i]['location'] = $value['location'];                  $i++;             }             //print_r($docs);exit;              $documents = array();             foreach($docs $item => $fields) {                 $part = new apache_solr_document();                  foreach ( $fields $key => $value ) {                     if ( is_array( $value ) ) {                         foreach ( $value $data ) {                             $part->setmultivalue( $key, $data );                         }                     }                     else{                         $part->$key = $value;                     }                 }                  $documents[] = $part;             }              try {                     $solr->adddocuments( $documents );                     $solr->commit();                     $solr->optimize();                   }                 catch ( exception $e ) {                     echo $e->getmessage();                 } 

after executing above code have manually restart solr through cmd line , gets reflected, want ask every time when add docs in solr have restart solr manually ? there other way restart solr automatically have data in docs.

any appreciated in advance.

for submitted documents visible in index, have issue commit - , ask new reader opened (this handled you, that's not necessary. how in drupal framework have no idea about, i'm guessing solr client has commit method or similar. tried searching api docs, came empty except _document class.

after commit has been issued index changes visible within few seconds, or in case of soft commit (where changes aren't persisted disk before later) instantly.

you can ask commitwithin interval when submitting documents, depend on how client you're using works how include parameter.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -