Solr: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
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. But I am sticking with it.


[https://hub.docker.com/_/solr/ official Solr Docker repo]
[https://hub.docker.com/_/solr/ official Solr Docker repo]


[https://www.apache.org/dyn/closer.cgi/lucene/solr/ref-guide/ Solr Reference Guide]; includes getting started instructions.
[https://www.apache.org/dyn/closer.cgi/lucene/solr/ref-guide/ Solr Reference Guide]; includes getting started instructions.
== How to do stuff ==
=== Create a core ===
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.
=== Show me the fields in a core's schema ===
curl htp://localhost:8983/solr/films/schema/fields


== How are docker volumes used? ==
== How are docker volumes used? ==

Revision as of 23:56, 13 May 2019

Apache Solr is a search platform built on Apache Lucene.

I have 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. But I am sticking with it.

official Solr Docker repo

Solr Reference Guide; includes getting started instructions.

How to do stuff

Create a core

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.

Show me the fields in a core's schema

curl htp://localhost:8983/solr/films/schema/fields

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 in the container.

Where's the web server?

I have it running behind my firewall right now at https://solr.wildsong.biz/.

How do I get shell access?

To get a bash shell,

docker exec -it --user=solr solr bash

"Cores" are the setups containing data and configuration. This worked to create the "taxlots" core.

docker exec -it --user=solr solr bin/solr create_core -c taxlots