Catégories
Lifestyle

Run Solr with a windows pc

This post is more a memo for my self than a tutorial.

Download Solr (http://lucene.apache.org/solr/) to c:/km/solr/
Dowload Jetty (http://www.eclipse.org/jetty/) to c:/km/jetty/
Download Curl (http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000%2FXP) to c:/km/curl

Follow this tutorial to run Solr : http://lucene.apache.org/solr/4_3_0/tutorial.html

Starting Solr : ~/solr/example$ java -jar start.jar
Index All XML documents from the exampledocs folder : ~/solr/example/exampledocs$ java -jar post.jar *.xml

Assume you have a doc file called doc2.doc in the folder, index it using : C:\km\solr\example\exampledocs> c:\km\curl\curl.exe "http://localhost:8983/solr/update/extract?literal.id=doc2&commit=true" -F "myfile=@doc2.doc"

Don’t forget to change the literal.id or it will replace the last document.

To verify that it has been properly indexed go to : http://localhost:8983/solr/collection1/browse
And type in something contained inside the document.

You can do the same with pdf.

To add the filename to the indexed file open :
C:\km\solr\example\solr\collection1\conf\schema.xml
and add :
Then index a file using :
C:\km\solr\example\exampledocs> c:\km\curl\curl.exe "http://localhost:8983/solr/update/extract?literal.id=doc2&literal.fullfilename=C:\km\solr\example\docexamples\doc2.doc&commit=true" -F "myfile=@doc2.doc"

Even simpler :
Index a file using :
C:\km\solr\example\exampledocs> c:\km\curl\curl.exe "http://localhost:8983/solr/update/extract?literal.id=doc2&literal.resourcename=C:\km\solr\example\docexamples\doc2.doc&commit=true" -F "myfile=@doc2.doc". It will appear directly in velocity !

Now my next step is to find out :

  • how to index a full windows folder structure
  • how to link with php