<?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>Rusty Razor Blade &#187; solr</title>
	<atom:link href="http://www.rustyrazorblade.com/category/solr/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rustyrazorblade.com</link>
	<description>Tech Thoughts, Mostly on LAMP - by Jon Haddad</description>
	<lastBuildDate>Fri, 13 Aug 2010 23:33:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using the Filter Query in Solr (fq)</title>
		<link>http://www.rustyrazorblade.com/2009/03/using-the-filter-query-in-solr-fq/</link>
		<comments>http://www.rustyrazorblade.com/2009/03/using-the-filter-query-in-solr-fq/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 21:43:53 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[solr]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=502</guid>
		<description><![CDATA[Filter queries are applied to a result set after it has generated the search results.  This can be useful in cases where you want to filter by category or user.
In my use case, I&#8217;d like to filter a list of questions by a group of categories on Answerbag.  This is used primarily for [...]]]></description>
			<content:encoded><![CDATA[<p>Filter queries are applied to a result set after it has generated the search results.  This can be useful in cases where you want to filter by category or user.</p>
<p>In my use case, I&#8217;d like to filter a list of questions by a group of categories on Answerbag.  This is used primarily for partner sites who&#8217;ve opted into our white label cobrand system and have selected a list of categories to restrict the site to.  It affects search results, as the goal is to limit searches to these categories.</p>
<p>Technically, this can be done on 2 levels.  First, it might be done in code, where we bring back a massive result set and filter out the questions that don&#8217;t satisfy our requirement.  Ideally it can be done on the search engine side, which would reduce network overhead and eliminate a few really weird bugs that can crop up as a result.</p>
<p>It turns out this is pretty easy &#8211; but you must send it through as a single filter query, and not separate params for each filter.</p>
<p>To limit your filters to certain categories, you&#8217;d add something along these lines to your GET request, assuming you&#8217;ve stored categories by their numeric primary key:</p>
<blockquote><p>
fq=category_id:(24 79 84 693 694 1270 2309 2821 3284)
</p></blockquote>
<p>As usual, comments and thoughts are encouraged.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2009/03/using-the-filter-query-in-solr-fq/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up a Solr Index</title>
		<link>http://www.rustyrazorblade.com/2009/02/setting-up-a-solr-index/</link>
		<comments>http://www.rustyrazorblade.com/2009/02/setting-up-a-solr-index/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 00:51:16 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[curl]]></category>
		<category><![CDATA[solr]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/?p=471</guid>
		<description><![CDATA[Setting up a solr index isn&#8217;t that hard, but I found the documentation to be somewhat hard to find.  It only took me a few hours from start to finish to go from download to indexing my documents, but I think it could have happened a lot faster if I had some of the [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up a solr index isn&#8217;t that hard, but I found the documentation to be somewhat hard to find.  It only took me a few hours from start to finish to go from download to indexing my documents, but I think it could have happened a lot faster if I had some of the below information.  I&#8217;m assuming you&#8217;ve already downloaded solr and you&#8217;re now looking at a directory with a bunch of files in it.</p>
<ul>
<li>Make a copy of the example directory found in the solr directory.  To make obvious, I just named it after the site I&#8217;m working on.  </li>
<li>You&#8217;ll want to edit the solr/conf/schema.xml file found in there.  It&#8217;s actually a really good sample file to get started with, so you&#8217;ll learn a whole bunch by starting there.  <a href="http://wiki.apache.org/solr/SchemaXml">Information on the solr schema</a>.  You&#8217;ll need to modify the configuration file for solr to function correctly with your schema. </li>
<li>If you&#8217;re using a PHP and curl, and you get the error &#8220;missing content stream&#8221;, you need to make sure you set your curl header<br />
<blockquote><p>curl_setopt($c, CURLOPT_HTTPHEADER, 	array(&#8221;Content-Type: text/xml&#8221;)); 	</p></blockquote>
</li>
<li>At one point, I received the error &#8220;Unexpected EOF in prolog&#8221; &#8211; this was because I originally had a &#8220;\n&#8221; at the end of my header (see previous note).  Removing it solved my problem.</li>
<p>Here&#8217;s a <a href="http://www.xml.com/lpt/a/1668">good solr starting point</a> that covers the schema and field types.
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2009/02/setting-up-a-solr-index/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Install the Lucene Search Engine using Solr</title>
		<link>http://www.rustyrazorblade.com/2008/03/how-to-install-the-lucene-search-engine-using-solr/</link>
		<comments>http://www.rustyrazorblade.com/2008/03/how-to-install-the-lucene-search-engine-using-solr/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 17:01:26 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[solr]]></category>

		<guid isPermaLink="false">http://www.rustyrazorblade.com/2008/03/15/how-to-install-the-lucene-search-engine-using-solr/</guid>
		<description><![CDATA[I&#8217;m going to go through the steps necessary to install and start using Solr.  I&#8217;ve always been interested in trying out Lucene, but I never felt like dealing with writing my own wrapper around the classes.  Solr simplifies this by creating a fully working search engine as a web service.
Let&#8217;s get started.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to go through the steps necessary to install and start using <a href="http://lucene.apache.org/solr/">Solr</a>.  I&#8217;ve always been interested in trying out Lucene, but I never felt like dealing with writing my own wrapper around the classes.  Solr simplifies this by creating a fully working search engine as a web service.</p>
<p>Let&#8217;s get started.  You&#8217;ll need to check to see if Java is up to date.  Run the below to find out.</p>
<blockquote><p>java -version </p></blockquote>
<p>You need to be running at least Java 1.5.  Next is to check to see if Ant is installed.  Do that with.</p>
<blockquote><p>ant -version</p></blockquote>
<p>I&#8217;m doing this on my Mac using Leopard.  <a href="http://dita-ot.sourceforge.net/doc/DITA-setupant.html">Here&#8217;s some instructions on setting up Ant</a> if you aren&#8217;t using Leopard.</p>
<p>Java was up to date, and ant is built in.  Sweet.  However, I need to install JUnit.  I&#8217;ll do that first.</p>
<p><a href="http://www.junit.org/">Download JUnit.</a>  You&#8217;ll need to put it somewhere that&#8217;s accessible by the $CLASSPATH variable.  There&#8217;s more information on the <a href="http://junit.sourceforge.net/doc/faq/faq.htm#started_2">JUnit FAQ</a>.</p>
<p>I threw it in /usr/share and left the name as junit-4.4.jar and set my CLASSPATH to point to that file (not the directory)</p>
<blockquote><p>export CLASSPATH=$CLASSPATH:/usr/share/junit-4.4.jar</p></blockquote>
<p>I ran that, as well as put it in my /etc/bashrc file (which you must be root to edit) so I don&#8217;t have to deal with it again.</p>
<p><strong>Compile Solr</strong></p>
<p>Switch back to the directory containing the solr files, and run:</p>
<blockquote><p>ant compile</p></blockquote>
<p>You should see something like this:</p>
<blockquote><p>Buildfile: build.xml</p>
<p>init-forrest-entities:</p>
<p>checkJunitPresence:</p>
<p>compile:<br />
    [javac] Compiling 185 source files to /Users/jhaddad/src/apache-solr-1.2.0/build<br />
    [javac] Note: Some input files use or override a deprecated API.<br />
    [javac] Note: Recompile with -Xlint:deprecation for details.<br />
    [javac] Note: Some input files use unchecked or unsafe operations.<br />
    [javac] Note: Recompile with -Xlint:unchecked for details.</p>
<p>BUILD SUCCESSFUL<br />
Total time: 3 seconds</p></blockquote>
<p>I then ran: </p>
<blockquote><p>ant dist</p></blockquote>
<p>Which outputted something like this:</p>
<blockquote><p>Buildfile: build.xml</p>
<p>init-forrest-entities:</p>
<p>checkJunitPresence:</p>
<p>compile:</p>
<p>make-manifest:<br />
    [mkdir] Created dir: /Users/jhaddad/src/apache-solr-1.2.0/build/META-INF</p>
<p>dist-jar:<br />
      [jar] Building jar: /Users/jhaddad/src/apache-solr-1.2.0/dist/apache-solr-1.2.1-dev.jar</p>
<p>dist-war:<br />
      [war] Building war: /Users/jhaddad/src/apache-solr-1.2.0/dist/apache-solr-1.2.1-dev.war</p>
<p>dist:</p>
<p>BUILD SUCCESSFUL<br />
Total time: 0 seconds</p></blockquote>
<p>You can run the example by going to the example directory and running </p>
<blockquote><p>java -jar start.jar</p></blockquote>
<p>Then go here: <a href="http://localhost:8983/solr/admin/">http://localhost:8983/solr/admin/</a> and check out your admin.</p>
<p>Load a few sample docs by going here:</p>
<blockquote><p>/example/exampledocs </p></blockquote>
<p>and running </p>
<blockquote><p>java -jar post.jar solr.xml monitor.xml </p></blockquote>
<p>I will post a follow up on how to get Solr running in Tomcat, as well as examples on how to use the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rustyrazorblade.com/2008/03/how-to-install-the-lucene-search-engine-using-solr/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
