<?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>5 &#8211; Solr.pl</title>
	<atom:link href="https://solr.pl/en/tag/5-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>Sat, 14 Nov 2020 13:57:36 +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 5 &#8211; JSON Request API, part one</title>
		<link>https://solr.pl/en/2015/12/21/solr-5-json-request-api-part-one/</link>
					<comments>https://solr.pl/en/2015/12/21/solr-5-json-request-api-part-one/#respond</comments>
		
		<dc:creator><![CDATA[Rafał Kuć]]></dc:creator>
		<pubDate>Mon, 21 Dec 2015 13:57:01 +0000</pubDate>
				<category><![CDATA[Solr]]></category>
		<category><![CDATA[5]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[request]]></category>
		<category><![CDATA[solr]]></category>
		<guid isPermaLink="false">http://sematext.solr.pl/?p=879</guid>

					<description><![CDATA[Solr 5 introduced a lot of changes to the world of the API&#8217;s and functionalities around Solr. JSON API and facets were the one that were moved from HeliosSearch project and resulted in users being able to send queries using]]></description>
										<content:encoded><![CDATA[<p>Solr 5 introduced a lot of changes to the world of the API&#8217;s and functionalities around Solr. JSON API and facets were the one that were moved from HeliosSearch project and resulted in users being able to send queries using JSON, which is a bit more human friendly compared to long queries constructed as URI. In this post we will introduce you to the world on JSON request API in Solr.</p>
<p><span id="more-879"></span></p>
<h2>Running a query</h2>
<p>I&#8217;m sure you are familiar on how to run queries to Solr in the standard, old fashioned way, right? So, to get documents that match the <em>solr</em> term in the <em>_text_</em> field we would just run a command like this:
</p>
<pre class="brush:xml">curl -XGET 'localhost:8983/solr/gettingstarted/select?q=_text_:solr&amp;indent=true'
</pre>
<p>Just for the record, I&#8217;m using the schemaless example provided with Solr and I indexed the data from the <em>docs</em> directory.</p>
<p>We can do the same using the JSON API of Solr. For example, a JSON structured query that would return exactly the same results as the one shown above would look as follows:
</p>
<pre class="brush:xml">curl -XGET 'localhost:8983/solr/gettingstarted/query' -d '{
 "query":"_text_:solr"
}'
</pre>
<p>As you can see, we just specify the query using a JSON object and the query property in it and we send it as a request body to the <em>/query</em> handler. We could also send the query to the <em>/select</em> handler, but the <em>/query</em> one uses JSON response by default, so it seems more appropriate for JSON queries <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;" /></p>
<p>We can also use the standard parameter names and pass them in the body of the request, just like this:
</p>
<pre class="brush:xml">curl -XGET 'localhost:8983/solr/gettingstarted/query' -d 'q=_text_:solr'
</pre>
<p>So, this time we didn&#8217;t have the JSON structure in the request body, we just pass the parameters there and separate them with <em>&amp;</em> character, just like when sending a query using URI request.</p>
<h2>Paging</h2>
<p>Of course, we can also page through the results when using JSON API. We do that by using the <em>limit</em> and and <em>offset</em> parameters. The <em>limit</em> parameter specifies the maximum number of returned documents and the <em>offset</em> parameter is responsible for telling Solr from which document the results should be returned. For example, to get 20 documents starting from the 11th one, we would run the following query:
</p>
<pre class="brush:xml">curl -XGET 'localhost:8983/solr/gettingstarted/query' -d '{
 "query":"_text_:solr",
 "limit":20,
 "offset":10
}'
</pre>
<h2>Sorting</h2>
<p>The next thing is the ability to sort the results and we can do that using Solr JSON API as well. To sort our results on the basis of the <em>id</em> field, in the descending order we would run the following query:
</p>
<pre class="brush:xml">curl -XGET 'localhost:8983/solr/gettingstarted/query' -d '{
 "query":"_text_:solr",
 "sort":"id desc"
}'
</pre>
<p>It is very similar to what we are used to when using the standard URI request queries, but we are using the <em>sort</em> property.</p>
<h2>Filtering</h2>
<p>Finally, we have filtering. We can filter our data by using the <em>filter</em> property. For example, to narrow down our data to only the ones that have <em>text/html</em> value in the <em>content_type</em> field we would run the following query:
</p>
<pre class="brush:xml">curl -XGET 'localhost:8983/solr/gettingstarted/query' -d '{
 "query":"_text_:solr",
 "filter":"content_type:text/html"
}'
</pre>
<h2>What&#8217;s next</h2>
<p>As you can see the JSON API of Solr is very easy to use and allows us to use more structured queries when talking to Solr. In the next entry we will discuss the JSON facets API, how to use it and what are other differences when it comes to JSON facets and the traditional implementation, because making the request is not the only difference when we compare those two.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://solr.pl/en/2015/12/21/solr-5-json-request-api-part-one/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Solr 5: replication throttling</title>
		<link>https://solr.pl/en/2015/01/26/solr-5-replication-throttling/</link>
					<comments>https://solr.pl/en/2015/01/26/solr-5-replication-throttling/#respond</comments>
		
		<dc:creator><![CDATA[Rafał Kuć]]></dc:creator>
		<pubDate>Mon, 26 Jan 2015 13:49:49 +0000</pubDate>
				<category><![CDATA[Solr]]></category>
		<category><![CDATA[5]]></category>
		<category><![CDATA[5.0]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[throttling]]></category>
		<guid isPermaLink="false">http://sematext.solr.pl/?p=853</guid>

					<description><![CDATA[In case our collection is very large (or there are a few of them) in a case when full replication is needed, Solr can use all the bandwidth of our network (if the disks are fast enough). This is good]]></description>
										<content:encoded><![CDATA[<p>In case our collection is very large (or there are a few of them) in a case when full replication is needed, Solr can use all the bandwidth of our network (if the disks are fast enough). This is good in some situations, but bad in others. Imagine that you have some collections being queried and of them starts to replicate a tens of gigabytes of data &#8211; all the other collections would suffer. Thankfully with the release of Solr 5 we got replication throttling and we can use it to limit the amount of data allowed to be transferred by Solr.</p>
<p><span id="more-853"></span></p>
<p>To show you how replication throttling works we will compare two use cases &#8211; one will copy 2GB index without any limits and the other will copy the same index, but with throttling enabled. To illustrate that we will use SolrCloud deployment, with very simple configuration. Please note, that replication throttling is not limited to SolrCloud deployments and can be used successfully in old master &#8211; slave architecture.</p>
<h3>Replication without throttling</h3>
<p>To show you how network bandwidth has been used we will use the following, standard replication handler configuration:
</p>
<pre class="brush:xml">&lt;requestHandler name="/replication" class="solr.ReplicationHandler"&gt;
&lt;/requestHandler&gt;
</pre>
<p>Network usage in that case looked as follows:</p>
<p><a href="http://solr.pl/wp-content/uploads/2015/01/replication_not_throttled.png"><img fetchpriority="high" decoding="async" class="aligncenter wp-image-3537 size-full" src="http://solr.pl/wp-content/uploads/2015/01/replication_not_throttled.png" alt="replication_not_throttled" width="552" height="192"></a></p>
<h3>Replication with throttling enabled</h3>
<p>Now let&#8217;s compare it to replication that is setup to use throttling:
</p>
<pre class="brush:xml">&lt;requestHandler name="/replication" class="solr.ReplicationHandler"&gt;
 &lt;lst name="defaults"&gt;
  &lt;str name="maxWriteMBPerSec"&gt;0.1&lt;/str&gt;
 &lt;/lst&gt;
&lt;/requestHandler&gt;
</pre>
<p>Network usage in this case looks as follows:</p>
<p><a href="http://solr.pl/wp-content/uploads/2015/01/replication_throttled.png"><img decoding="async" class="aligncenter wp-image-3532 size-large" src="http://solr.pl/wp-content/uploads/2015/01/replication_throttled-1024x347.png" alt="replication_throttled" width="512" height="173"></a>As we can see the difference is large and throttling works as intended <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;" /></p>
<h3>Short summary</h3>
<p>As we can see the configuration itself is very simple and it just works. Again, it does work in master &#8211; slave and in SolrCloud deployments, so no matter which way you go, you can use replication throttling. The only thing that is missing now, at least for me, is dedicated API that I could use to change the replication configuration without core reload. Maybe in the future? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://solr.pl/en/2015/01/26/solr-5-replication-throttling/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
