<?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>real &#8211; Solr.pl</title>
	<atom:link href="https://solr.pl/en/tag/real-2/feed/" rel="self" type="application/rss+xml" />
	<link>https://solr.pl/en/</link>
	<description>All things to be found - Blog related to Apache Solr &#38; Lucene projects - https://solr.apache.org</description>
	<lastBuildDate>Wed, 11 Nov 2020 20:58:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>Solr 4.0: Realtime GET</title>
		<link>https://solr.pl/en/2012/01/09/solr-4-0-realtime-get/</link>
					<comments>https://solr.pl/en/2012/01/09/solr-4-0-realtime-get/#respond</comments>
		
		<dc:creator><![CDATA[Rafał Kuć]]></dc:creator>
		<pubDate>Mon, 09 Jan 2012 20:57:41 +0000</pubDate>
				<category><![CDATA[Solr]]></category>
		<category><![CDATA[4.0]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[near]]></category>
		<category><![CDATA[nrt]]></category>
		<category><![CDATA[real]]></category>
		<category><![CDATA[solr]]></category>
		<guid isPermaLink="false">http://sematext.solr.pl/?p=392</guid>

					<description><![CDATA[The next functionality I decided to look at, from the upcoming Solr 4.0, is the so called &#8220;Realtime Get&#8221;. It allows you to see the data even though it was not yet added to the index, thus before the commit&#160;operation]]></description>
										<content:encoded><![CDATA[<p>The next functionality I decided to look at, from the upcoming Solr 4.0, is the so called &#8220;Realtime Get&#8221;. It allows you to see the data even though it was not yet added to the index, thus before the <em>commit</em>&nbsp;operation being sent to Solr. Let&#8217;s see how it works.</p>
<p><span id="more-392"></span></p>
<h3>Some theory</h3>
<p>Data update in Lucene and Solr has one disadvantage &#8211; when you submit index updates they can&#8217;t be seen until <em>commit</em>&nbsp;operation is run. The problem is that <em>commit</em>&nbsp;is costly in terms of performance and intense commiting may cause performance problems. So, when you need your data to be visible right after being change you may be forced to choose &#8211; either performance, or fast updates. In order to address that Lucene and Solr are working towards enabling <em>Near Real Time</em>&nbsp;(NRT) searching. In Lucene we have that possibility, in Solr 4.0 we will also be able to use that and not only that.</p>
<h3>Configuration</h3>
<p>In order to use <em>Realtime Get</em>&nbsp;functionality we need to configure the following Solr features:</p>
<h4>Transaction log</h4>
<p>The first thing to configure is the transaction log writing. In order to do that you need to add the following to your <em>updateHandler</em>&nbsp;configuration:
</p>
<pre class="brush:xml">&lt;updateLog&gt;
  &lt;str name="dir"&gt;
<p>The above entry says, that the directory holding transaction log will be located in the same directory where the index directory is located.</p>
<h4>Realtime Get handler</h4>
<p>The second thing that needs to be done, to see the <em>Realtime Get</em>&nbsp;in action, is the appropriate handler configuration (or adding component to your already defined handler). To do that add the following to your&nbsp;<em>solrconfig.xml file</em>:
</p>
<pre class="brush:xml">&lt;requestHandler name="/get" class="solr.RealTimeGetHandler"&gt;
  &lt;lst name="defaults"&gt;
    &lt;str name="omitHeader"&gt;true&lt;/str&gt;
  &lt;/lst&gt;
&lt;/requestHandler&gt;</pre>
<p>The above entry it's nothing unusual - it just add a new request handler implementing <em>solr.RealTimeGetHandler</em>&nbsp;class, which enables checking the transaction log.</p>
<h3>Action</h3>
<p>To check how&nbsp;<em>Realtime Get</em>&nbsp;works I decided to do a simple test. The first thing I did is indexing one file (from the ones that are available in the&nbsp;<em>exampledocs</em>&nbsp;directory) with the use of the following bash command:
</p>
<pre class="brush:bash">curl 'http://localhost:8983/solr/update' -d @hd.xml -H 'Content-type:application/xml'</pre>
<p>Of course I did not send the <em>commit</em>&nbsp;operation after indexing. As we could expect the following query:
</p>
<pre class="brush:bash">http://localhost:8983/solr/select?q=*:*</pre>
<p>didn't return search results. So let's check, if the handler registered as&nbsp;<em>/get</em>&nbsp;will be able to get us some results. In order to do that I send the following query:
</p>
<pre class="brush:bash">http://localhost:8983/solr/get?id=SP2514N</pre>
<p>And in result I got the following document:
</p>
<pre class="brush:xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;response&gt;
&lt;doc name="doc"&gt;
  &lt;str name="id"&gt;SP2514N&lt;/str&gt;
  &lt;str name="name"&gt;Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133&lt;/str&gt;
  &lt;str name="manu"&gt;Samsung Electronics Co. Ltd.&lt;/str&gt;
  &lt;str name="manu_id_s"&gt;samsung&lt;/str&gt;
  &lt;arr name="cat"&gt;
    &lt;str&gt;electronics&lt;/str&gt;
    &lt;str&gt;hard drive&lt;/str&gt;
  &lt;/arr&gt;
  &lt;arr name="features"&gt;
    &lt;str&gt;7200RPM, 8MB cache, IDE Ultra ATA-133&lt;/str&gt;
    &lt;str&gt;NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor&lt;/str&gt;
  &lt;/arr&gt;
  &lt;float name="price"&gt;92.0&lt;/float&gt;
  &lt;int name="popularity"&gt;6&lt;/int&gt;
  &lt;bool name="inStock"&gt;true&lt;/bool&gt;
  &lt;date name="manufacturedate_dt"&gt;2006-02-13T15:26:37Z&lt;/date&gt;
  &lt;str name="store"&gt;35.0752,-97.032&lt;/str&gt;&lt;/doc&gt;
&lt;/response&gt;</pre>
<p>So Solr returned the result that wasn't added to the index - nice !</p>
<h3>Usage possibilities</h3>
<p>You probably noticed, that in order to fetch a document with <em>/get</em>&nbsp;handler I needed to provide it's unique identifier (or identifiers list). That's true, <em>Realtime Get</em>&nbsp;doesn't support searching, because it was not created to support full searching. This functionality is able to show us the updates of the documents which identifiers are known (so for example the ones in the index) - in example by adding the component used in <em>solr.RealTimeGetHandler</em> to any of your defined handler. And the good news is - you don't have to worry update performance - <em>solr.RealTimeGet</em>&nbsp;is very fast. So, if one of your problems is frequent updated you can look in the future with a smile <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><em></em></p>
<h3>Last few words</h3>
<p>The <em>Realtime Get</em>&nbsp;functionality brings new possibilities when it comes to Solr and also on the road to the SolrCloud. With the use of transaction log one can implement automatic cluster node restore or instance NRT instance updates. As you can see Solr 4.0 is not only about search, but also about data store and bringing Solr closer to NoSQL solutions.</p>
<p>{solr.data.dir:}&lt;/str&gt;<br />
&lt;/updateLog&gt;</p>
<p>The above entry says, that the directory holding transaction log will be located in the same directory where the index directory is located.</p>
<h4>Realtime Get handler</h4>
<p>The second thing that needs to be done, to see the <em>Realtime Get</em>&nbsp;in action, is the appropriate handler configuration (or adding component to your already defined handler). To do that add the following to your&nbsp;<em>solrconfig.xml file</em>:
</p>
<pre wp-pre-tag-1=""></pre>
<p>The above entry it&#8217;s nothing unusual &#8211; it just add a new request handler implementing <em>solr.RealTimeGetHandler</em>&nbsp;class, which enables checking the transaction log.</p>
<h3>Action</h3>
<p>To check how&nbsp;<em>Realtime Get</em>&nbsp;works I decided to do a simple test. The first thing I did is indexing one file (from the ones that are available in the&nbsp;<em>exampledocs</em>&nbsp;directory) with the use of the following bash command:
</p>
<pre wp-pre-tag-2=""></pre>
<p>Of course I did not send the <em>commit</em>&nbsp;operation after indexing. As we could expect the following query:
</p>
<pre wp-pre-tag-3=""></pre>
<p>didn&#8217;t return search results. So let&#8217;s check, if the handler registered as&nbsp;<em>/get</em>&nbsp;will be able to get us some results. In order to do that I send the following query:
</p>
<pre wp-pre-tag-4=""></pre>
<p>And in result I got the following document:
</p>
<pre wp-pre-tag-5=""></pre>
<p>So Solr returned the result that wasn&#8217;t added to the index &#8211; nice !</p>
<h3>Usage possibilities</h3>
<p>You probably noticed, that in order to fetch a document with <em>/get</em>&nbsp;handler I needed to provide it&#8217;s unique identifier (or identifiers list). That&#8217;s true, <em>Realtime Get</em>&nbsp;doesn&#8217;t support searching, because it was not created to support full searching. This functionality is able to show us the updates of the documents which identifiers are known (so for example the ones in the index) &#8211; in example by adding the component used in <em>solr.RealTimeGetHandler</em> to any of your defined handler. And the good news is &#8211; you don&#8217;t have to worry update performance &#8211; <em>solr.RealTimeGet</em>&nbsp;is very fast. So, if one of your problems is frequent updated you can look in the future with a smile <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /><em></em></p>
<h3>Last few words</h3>
<p>The <em>Realtime Get</em>&nbsp;functionality brings new possibilities when it comes to Solr and also on the road to the SolrCloud. With the use of transaction log one can implement automatic cluster node restore or instance NRT instance updates. As you can see Solr 4.0 is not only about search, but also about data store and bringing Solr closer to NoSQL solutions.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://solr.pl/en/2012/01/09/solr-4-0-realtime-get/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
