Re: how to index data in solr form database automatically
On 27/06/11 11:01, Romi wrote: Can i not use it for full-import ?? yes!!! You must only change urlCmd='http://localhost:8080/solr/mycore/dataimport?command=delta-import&clean=false' in urlCmd='http://localhost:8080/solr/mycore/dataimport?command=full-import&clean=false' or urlCmd='http://localhost:8080/solr/mycore/dataimport?command=full-import&clean=true' or as you desire!! Consult DIH handler wiki for the complete list of support params.. -- Renato Eschini Inera srl Via Mazzini 138 56100 Pisa (PI) Tel:(+39) (0)50 9911800 Fax:(+39) (0)50 9911830 Int:(+39) (0)50 9911819 Email: r.esch...@inera.it Msn:r_esch...@hotmail.com Skype: renato.eschini WWW:http://www.inera.it Rispetta l'ambiente - è veramente necessario stampare questa e-mail? Please consider the environment - do you really need to print this e-mail?
Re: how to index data in solr form database automatically
Start from this point: http://wiki.apache.org/solr/DataImportHandler So, you can try to use this script: #!/bin/bash wgetProgram=wget urlCmd='http://localhost:8080/solr/mycore/dataimport?command=delta-import&clean=false' statusCmd='http://localhost:8080/solr/mycore/dataimport?command=status' outputDir=. $wgetProgram -O $outputDir/check_status_update_index.txt ${statusCmd} 2>/dev/null status=`fgrep idle $outputDir/check_status_update_index.txt` if [[ ${status} == *idle* ]] then $wgetProgram -O $outputDir/status_update_index.txt ${urlCmd} 2>/dev/null fi save it somewhere (ex. /root/script_solr) like "update-solr.sh" and chmod +x. Now you can config it from root user in crontab: linux:~# crontab -e and insert for run every 2 minutes: */2 * * * * cd /root/script_solr && /root/script_solr/update-solr.sh On 27/06/11 09:01, Romi wrote: Thanks for answering but i don't know how to write script for fetching data from database and index it in to solr and how to setup this script as cron-job to run automatically at certain interval. Please suggest -- Renato Eschini Inera srl Via Mazzini 138 56100 Pisa (PI) Tel:(+39) (0)50 9911800 Fax:(+39) (0)50 9911830 Int:(+39) (0)50 9911819 Email: r.esch...@inera.it Msn:r_esch...@hotmail.com Skype: renato.eschini WWW:http://www.inera.it Rispetta l'ambiente - è veramente necessario stampare questa e-mail? Please consider the environment - do you really need to print this e-mail?
Re: how to index data in solr form database automatically
Why don't you use DataImportHandler? We use DIH, we have a wget based bash script that is runned by cron every about 2 minutes. DIH is called in delta-query mode. The bash script waork in this way: 1) first call a wget on DIH status 2) analyze wget DIH status "/dataimport?command=status" 2.1) if status is **busy** do nothing and exit (beacuse DIH is already running) 2.2) if status is **idle** do "/dataimport?command=delta-import&clean=false" 3) exit On 24/06/11 15:20, Mohammad Shariq wrote: First write a Script in Python ( or JAVA or PHP or anyLanguage) which reads the data from database and index into Solr. Now setup this script as cron-job to run automatically at certain interval. -- Renato Eschini Inera srl Via Mazzini 138 56100 Pisa (PI) Tel:(+39) (0)50 9911800 Fax:(+39) (0)50 9911830 Int:(+39) (0)50 9911819 Email: r.esch...@inera.it Msn:r_esch...@hotmail.com Skype: renato.eschini WWW:http://www.inera.it Rispetta l'ambiente - è veramente necessario stampare questa e-mail? Please consider the environment - do you really need to print this e-mail?