Solr/Lucene Scorer

Scorer are parts of lucene Queries via the ‘weight’ query method. In short, the framework calls Query.weight(..).scorer(..) . Have a look at http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/search/Query.html http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/search/Weight.html http://lucene.apache.org/jva/2_4_0/api/org/apache/lucene/search/Scorer.html To use your own Query class in Solr, you’ll need to implement your own solr QueryParserPlugin that uses your own QParser that generates your previously implemented lucene Query. You then … Read more

Remove results below a certain score threshold in Solr/Lucene?

You could write your own Collector that would ignore collecting those documents that the scorer places below your threshold. Below is a simple example of this using Lucene.Net 2.9.1.2 and C#. You’ll need to modify the example if you want to keep the calculated score. using System; using System.Collections.Generic; using Lucene.Net.Index; using Lucene.Net.Search; public class … Read more

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

Update specific field on SOLR index

Solr does not support updating individual fields yet, but there is a JIRA issue about this (almost 3 years old as of this writing). Until this is implemented, you have to update the whole document. UPDATE: as of Solr 4+ this is implemented, here’s the documentation.