Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The following page has been changed by JasonRutherglen:
http://wiki.apache.org/solr/BloomIndexComponent

New page:
= Introduction =

<!> ["Solr1.5"]

The !BloomIndexComponent !SearchComponent enables a fast and memory efficient 
membership test of an element in a read only set.  False positives may be 
returned which can be tuned using a given probability (see the errorrate 
parameter).  

The Solr implementation generates the Bloom Filter per Lucene segment for a 
particular field by iterating over the term dictionary.  

see [http://en.wikipedia.org/wiki/Bloom_filter Wikipedia Bloom Filter] or
[http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/util/bloom/BloomFilter.html
 Hadoop BloomFilter]

= How it Works =

To use the !BloomIndexComponent, 

The params are:
 * q={String} - The id to lookup (i.e. id:1)

For a non-distributed membership test, the output returns true or false.
For a distributed membership test, the output is the responses from the Solr 
shards.  

== Non-distributed Negative ==
{{{
http://localhost:8983/solr/bloom?q=id:1
}}}

Check the membership of the value 1 in the field id (which does not exist).

Results:
{{{
<response>
  <lst name="responseHeader">
    <int name="status">0</int>
    <int name="QTime">1</int>
  </lst>
  <str name="field">id</str>
  <str name="value">1</str>
  <str name="host">host.lightningstrike.com</str>
  <str name="exists">false</str>
</response>

}}}

== Non-distributed Positive ==
{{{
http://localhost:8983/solr/bloom?q=id:1
}}}

Check the membership of the value 1 in the field id (which does exist).

Results:
{{{
<response>
  <lst name="responseHeader">
    <int name="status">0</int>
    <int name="QTime">1</int>
  </lst>
  <str name="exists">true</str>
  <str name="segment">_0</str>
  <str name="field">id</str>
  <str name="value">1</str>
  <str name="host">host.lightningstrike.com</str>
</response>
}}}

== solrconfig.xml ==
{{{
<!-- Default Bloom Filter Implementation -->
<searchComponent name="bloom" 
class="org.apache.solr.handler.component.BloomIndexComponent">
  <str name="dir">bloom</str> <!-- optional -->
  <str name="field">id</str> <!-- optional -->
  <boolean name="autoreload">true</boolean> <!-- optional -->
  <str name="classname">org.apache.solr.bloom.BloomKeySet</str> <!-- optional 
-->
  <float name="errorrate">0.003f</float> <!-- optional -->
  <int name="hashcount">5</int> <!-- optional -->
</searchComponent>

<requestHandler name="/bloom" 
class="org.apache.solr.handler.component.SearchHandler">
  <arr name="components">
    <str>bloom</str>
  </arr>
</requestHandler>
}}}

Reply via email to