Last active
February 27, 2016 04:05
-
-
Save pslusarz/7de913ac63e36e8983b8 to your computer and use it in GitHub Desktop.
Solr for text searching in 1..2..3..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Works in Solr 5.3.0 | |
Core is Solr concept for a collection of documents / corpus of data. Replace <core> with your own corpus name. | |
$ bin/solr start | |
$ bin/solr create -c <core> | |
#text is not stored by default | |
$ curl -X POST -H 'Content-type:application/json' --data-binary '{ | |
"replace-field":{ | |
name: "_text_", | |
type: "text_general", | |
multiValued: true, | |
indexed: true, | |
stored: true | |
} | |
}' http://localhost:8983/solr/<core>/schema | |
# text documents to be indexed on local folder .../text | |
$ bin/post -c <core> .../text/ | |
#query through admin interface, | |
http://localhost:8983/solr/#/<core>/query | |
#but remember to check "hl" which stands for "highlight" and set hl.snippets=100 in free params box | |
http://localhost:8983/solr/<core>/select?q=Fabryka&wt=json&indent=true&hl=true&hl.simple.pre=%3Cem%3E&hl.simple.post=%3C%2Fem%3E&hl.requireFieldMatch=true&hl.usePhraseHighlighter=true&hl.highlightMultiTerm=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment