Restricting IP addresses for Jetty and Solr

Solr 4.2.1 uses Jetty 8.1.8. Jetty 8 (as noted by jonas789) doesn’t support .htaccess. Instead, it uses IPAccessHandler, which doesn’t have great documentation available. I had to play with it quite a bit to get it work, so I’m posting an updated solution here. IPAccessHandler manages a blacklist and a whitelist, accepts arbitrary ranges of … Read more

Solr documents with child elements?

As of Solr 4.7 and 4.8, Solr supports nested documents: { “id”: “chapter1”, “title” : “Indexing Child Documents in JSON”, “content_type”: “chapter”, “_childDocuments_”: [ { “id”: “1-1”, “content_type”: “page”, “text”: “ho hum… this is page 1 of chapter 1” }, { “id”: “1-2”, “content_type”: “page”, “text”: “more text… this is page 2 of chapter 1” … Read more

solrj api for partial document update

As it turns out, the code snippet shown above in the question actually works. I don’t know what was wrong the first time I tried it, perhaps I simply forgot to commit or my schema was misconfigured. In any case, this question is very localized. However, since the api with the hash map is so … Read more

Solr Custom Similarity

I figured it out on my own. I have stored my own implementation of DefaultSimilarity under /dist/ folder in solr. Then i add <lib dir=”../../../dist/org/apache/lucene/search/similarities/” regex=”.*\.jar”/> to my solrconfig.xml and everything works fine. package org.apache.lucene.search.similarities; import org.apache.lucene.index.FieldInvertState; import org.apache.lucene.search.similarities.DefaultSimilarity; public class MyNewSimilarityClass extends DefaultSimilarity { @Override public float coord(int overlap, int maxOverlap) { return 1.0f; … Read more

Solr index vs stored

That is correct. Typically you will want your field to be either indexed or stored or both. If you set both to false, that field will not be available in your Solr docs (either for searching or for displaying). See Alexandre’s answer for the special cases when you will want to set both to false. … Read more