<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lucid Imagination &#187; frange</title>
	<atom:link href="http://www.lucidimagination.com/blog/tag/frange/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lucidimagination.com/blog</link>
	<description>Exclusively dedicated to Apache Lucene/Solr open source search technology</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:12:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Ranges over Functions in Solr 1.4</title>
		<link>http://www.lucidimagination.com/blog/2009/07/06/ranges-over-functions-in-solr-14/</link>
		<comments>http://www.lucidimagination.com/blog/2009/07/06/ranges-over-functions-in-solr-14/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 01:43:02 +0000</pubDate>
		<dc:creator>yonik</dc:creator>
				<category><![CDATA[Lucene]]></category>
		<category><![CDATA[Solr]]></category>
		<category><![CDATA[frange]]></category>
		<category><![CDATA[function query]]></category>
		<category><![CDATA[qparser]]></category>
		<category><![CDATA[range filter]]></category>
		<category><![CDATA[range query]]></category>

		<guid isPermaLink="false">http://www.lucidimagination.com/blog/?p=778</guid>
		<description><![CDATA[<p>Solr 1.4 contains a new feature that allows range queries or range filters over arbitrary functions.  It&#8217;s implemented as a standard <a href="http://lucene.apache.org/solr/api/org/apache/solr/search/FunctionRangeQParserPlugin.html">Solr QParser plugin</a>, and thus easily available for use any place that accepts the standard <a href="http://wiki.apache.org/solr/SolrQuerySyntax">Solr Query Syntax</a> by specifying the <strong>frange </strong>query type.  Here&#8217;s an example of a filter specifying the lower and upper bounds for a function:</p>
<p><code>fq={!frange l=0 u=2.2}log(sum(user_ranking,editor_ranking))</code></p>
<p>The other interesting use for frange is to trade off memory &#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Solr 1.4 contains a new feature that allows range queries or range filters over arbitrary functions.  It&#8217;s implemented as a standard <a href="http://lucene.apache.org/solr/api/org/apache/solr/search/FunctionRangeQParserPlugin.html">Solr QParser plugin</a>, and thus easily available for use any place that accepts the standard <a href="http://wiki.apache.org/solr/SolrQuerySyntax">Solr Query Syntax</a> by specifying the <strong>frange </strong>query type.  Here&#8217;s an example of a filter specifying the lower and upper bounds for a function:</p>
<p><code>fq={!frange l=0 u=2.2}log(sum(user_ranking,editor_ranking))</code></p>
<p>The other interesting use for frange is to trade off memory for speed when doing range queries on any type of single-valued field.  For example, one can use <strong>frange </strong>on a string field provided that there is only one value per field, and that numeric functions are avoided.</p>
<p>For example, here is a filter that only allows authors between martin and rowling, specified using a standard range query:<br />
<code>fq=author_last_name:[martin TO rowling]</code></p>
<p>And the same filter using a function range query (<strong>frange</strong>):<br />
<code>fq={!frange l=martin u=rowling}author_last_name</code></p>
<p>This can lead to significant performance improvements for range queries with many terms between the endpoints, at the cost of memory to hold the un-inverted form of the field in memory (i.e. a FieldCache entry &#8211; same as would be used for sorting).  If the field in question is already being used for sorting or other function queries, there won&#8217;t be any additional memory overhead.</p>
<p>The following chart shows the results of a test of frange queries vs standard range queries on a string field with 200,000 unique values.  For example, frange was 14 times faster when executing a range query / range filter that covered 20% of the terms in the field.  For narrower ranges that matched less than 5% of the values, the traditional range query performed better.</p>
<table border="1">
<tbody>
<tr>
<th>Percent of terms covered</th>
<th>Fastest implementation</th>
<th>Speedup (how many times faster)</th>
</tr>
<tr>
<td>100%</td>
<td>frange</td>
<td>43.32</td>
</tr>
<tr>
<td>20%</td>
<td>frange</td>
<td>14.25</td>
</tr>
<tr>
<td>10%</td>
<td>frange</td>
<td>8.07</td>
</tr>
<tr>
<td>5%</td>
<td>frange</td>
<td>1.337</td>
</tr>
<tr>
<td>1%</td>
<td>normal range query</td>
<td>3.59</td>
</tr>
</tbody>
</table>
<p>Of course, Solr 1.4 also contains the new <a href="http://www.lucidimagination.com/blog/2009/05/13/exploring-lucene-and-solrs-trierange-capabilities/">TrieRange </a>functionality that will generally have the best time/space profile for range queries over numeric fields.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lucidimagination.com/blog/2009/07/06/ranges-over-functions-in-solr-14/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

