Solr: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
[http://lucene.apache.org/solr/ Apache Solr] is a search platform built on Apache Lucene. | [http://lucene.apache.org/solr/ Apache Solr] is a search platform built on Apache Lucene. | ||
I have official Solr 8.0.0 running in a Docker container. | I have the official Solr 8.0.0 running in a Docker container. | ||
I am learning how to put data into it now. | I am learning how to put data into it now. | ||
Line 7: | Line 7: | ||
I've been watching this guy's videos. https://factorpad.com/tech/solr/tutorial/solr-tutorial.html | I've been watching this guy's videos. https://factorpad.com/tech/solr/tutorial/solr-tutorial.html | ||
He says the standard Solr tutorials jump in too fast and I tend to agree but these are a bit too far the other direction. | He says the standard Solr tutorials jump in too fast and I tend to agree but these are a bit too far the other direction. They are a bit lightweight but follow up watching with the reference guide. They form a good starting point. | ||
[https://hub.docker.com/_/solr/ official Solr Docker repo] | [https://hub.docker.com/_/solr/ official Solr Docker repo] | ||
Line 16: | Line 16: | ||
I am keeping solr's data in a volume that can be found at /home/docker/volumes/solr_data/_data on [[Bellman]]. | I am keeping solr's data in a volume that can be found at /home/docker/volumes/solr_data/_data on [[Bellman]]. | ||
It's mounted at /var/lib/solr | It's mounted at /var/lib/solr inside the container. | ||
== Where's the web server? == | == Where's the web server? == | ||
In the web server you can perform administrative tasks and you can run queries too. | In the web server you can perform administrative tasks and you can run queries too. | ||
I have it running behind my firewall right now: https://solr.wildsong.biz/solr | I have it running behind a reverse proxy and behind my firewall right now; I access it at: https://solr.wildsong.biz/solr | ||
== How to do stuff == | == How to do stuff == | ||
Line 27: | Line 27: | ||
=== Get shell access? === | === Get shell access? === | ||
To get a bash shell, | To get a bash shell, so you can look around, | ||
docker exec -it --user=solr solr bash | docker exec -it --user=solr solr bash | ||
Normal management is via REST API so you don't usually get much benefit from using a shell. | |||
=== Create a core? === | === Create a core? === | ||
In the command line environment, you'd do it with the bin/solr command. | |||
The following is assuming the core name is "films" and we're using the sample data that came with Solr download. | The following is assuming the core name is "films" and we're using the sample data that came with Solr download. | ||
Revision as of 03:46, 17 May 2019
Apache Solr is a search platform built on Apache Lucene.
I have the official Solr 8.0.0 running in a Docker container. I am learning how to put data into it now.
Docs
I've been watching this guy's videos. https://factorpad.com/tech/solr/tutorial/solr-tutorial.html He says the standard Solr tutorials jump in too fast and I tend to agree but these are a bit too far the other direction. They are a bit lightweight but follow up watching with the reference guide. They form a good starting point.
Solr Reference Guide; includes getting started instructions.
How are docker volumes used?
I am keeping solr's data in a volume that can be found at /home/docker/volumes/solr_data/_data on Bellman. It's mounted at /var/lib/solr inside the container.
Where's the web server?
In the web server you can perform administrative tasks and you can run queries too. I have it running behind a reverse proxy and behind my firewall right now; I access it at: https://solr.wildsong.biz/solr
How to do stuff
Get shell access?
To get a bash shell, so you can look around,
docker exec -it --user=solr solr bash
Normal management is via REST API so you don't usually get much benefit from using a shell.
Create a core?
In the command line environment, you'd do it with the bin/solr command. The following is assuming the core name is "films" and we're using the sample data that came with Solr download.
cd source/solr/solr-8.0.0
Create the core
bin/solr create_core -c films
Edit the schema per the tutorial. First using the GUI, add a field called "name" set type to "text_general" and uncheck "indexed" and "uninvertible". Then to demo using the REST command, we did this; I am not sure what it does. But we did it.
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-copy-field" : {"source":"*","dest":"_text_"}}' \ http://localhost:8983/solr/films/schema
Add data to it
bin/post -c films example/films/films.json
If you run the same post command twice it will just index the same data again, so it changes nothing internally.
Delete a core
In Docker,
docker exec -it solr bin/solr delete -c corename
I bet there is a curl command too.
Show the fields in a core's schema
Wiki bug?? If I put the http in the right place on the next line I cannot save it. You know what to do.
curl hachteeteepee://localhost:8983/solr/films/schema/fields