{"id":25,"date":"2011-12-22T22:45:02","date_gmt":"2011-12-23T03:45:02","guid":{"rendered":"http:\/\/www.thefaberfamily.org\/search-smith\/?p=25"},"modified":"2012-01-16T10:29:49","modified_gmt":"2012-01-16T15:29:49","slug":"verity-to-solr-addendum","status":"publish","type":"post","link":"http:\/\/www.thefaberfamily.org\/search-smith\/2011\/12\/verity-to-solr-addendum\/","title":{"rendered":"Verity to Solr Addendum"},"content":{"rendered":"<p>One day into this blog and I&#8217;m already lying about upcoming posts! Seriously, I noticed reading over my first post that I had unintentionally left a couple of things out.<\/p>\n<p>The first is a postscript to <a href=\"http:\/\/www.coldfusionmuse.com\/index.cfm\/2010\/4\/4\/solr-troubleshooting-coldfusion-9\" target=\"_blank\">the blog post I cited by ColdFusion Muse<\/a>. This blog post dealt with some issues caused by using Solr with the default (as installed under ColdFusion) options for the JVM. One of these options is<\/p>\n<pre>-XX:+AggressiveOpts<\/pre>\n<p>Oracle, the maintainer of Java since its takeover of Sun, <a href=\"https:\/\/issues.apache.org\/jira\/browse\/LUCENE-3537\">has the following to say on this subject<\/a> (kudos to a colleague for turning this up):<\/p>\n<blockquote><p>On the same day, Oracle released <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/6u29-relnotes-507960.html\">Java 6u29<\/a> fixing the same problems occurring with Java 6, if the JVM switches <code>-XX:+AggressiveOpts<\/code> or <code>-XX:+OptimizeStringConcat<\/code> were used. Of course, you should <strong>not<\/strong> use experimental JVM options like <code>-XX:+AggressiveOpts<\/code> in production environments! We recommend everybody to upgrade to this latest version 6u29.<\/p><\/blockquote>\n<p>Now I can&#8217;t speak for anyone else, but I do find it strange that Solr would be configured by default (at least in its ColdFusion edition) to use an experimental JVM option. It&#8217;s not as if this is a new option, or that it was originally used for some other purpose. Sun mentioned that it was an experimental option in <a href=\"http:\/\/java.sun.com\/performance\/reference\/whitepapers\/tuning.html#section4.2.4\">a 2005 white paper on Java Tuning<\/a>:<\/p>\n<blockquote><p><code>-XX:+AggressiveOpts<\/code><br \/>\nTurns on point performance optimizations that are expected to be on by default in upcoming releases. The changes grouped by this flag are minor changes to JVM runtime compiled code and not distinct performance features (such as BiasedLocking and ParallelOldGC). This is a good flag to try the JVM engineering team&#8217;s latest performance tweaks for upcoming releases. Note: this option is <em>experimental<\/em>! The specific optimizations enabled by this option can change from release to release and even build to build. You should reevaluate the effects of this option with prior to deploying a new release of Java.<\/p><\/blockquote>\n<p>The other thing that I omitted was a short discussion on how to search a Solr collection on a custom field, or how to filter a search. Let&#8217;s consider the Solr query from <a title=\"ColdFusion 9: Upgrading from Verity to Solr\" href=\"http:\/\/www.thefaberfamily.org\/search-smith\/2011\/12\/coldfusion-9-upgrading-from-verity-to-solr\/\">the previous post<\/a>:<\/p>\n<p>http:\/\/localhost:8983\/solr\/core0\/select?q=cancer&#038;fl=*,score&#038;wt=json<\/p>\n<p>This is just a plain-vanilla keyword search &#8212; there are no custom fields involved at all (well, there could be &#8212; but more on that later unless I am lying about future posts again). If we want to search on a custom field, we can do the following:<\/p>\n<pre>http:\/\/localhost:8983\/solr\/core0\/select?q=custom1:cancer&amp;fl=*,score&amp;wt=json<\/pre>\n<p>If we want to filter (filtering will search the field, but it won&#8217;t affect the results&#8217; scores) the search on a custom field, we can do the following:<\/p>\n<pre>http:\/\/localhost:8983\/solr\/core0\/select?q=cancer&amp;fl=*,score&amp;wt=json&amp;fq=custom1:cancer<\/pre>\n<p>The &#8220;fq&#8221; parameter is used for <em>f<\/em>ilter <em>q<\/em>ueries and I believe the same syntax is used for this parameter as is used for the &#8220;q&#8221; parameter.<\/p>\n<p>What if you want to search or filter on TWO (or more) custom fields? That is easy enough.<\/p>\n<pre>http:\/\/localhost:8983\/solr\/core0\/select?q=cancer&amp;fl=*,score&amp;wt=json&amp;fq=%2Bcustom1:cancer%20%2Bcustom2:mesothelioma<\/pre>\n<p>The &#8220;%2B&#8221; codes are url-encoded plus (+) signs, used because the &#8220;+&#8221; sign is used to url-encode spaces, while &#8220;%20&#8221; is the code for a url-encoded space. I suppose one might use a + sign here instead, but that might get confusing. (As an aside, I am old enough that some of the oldest code I used was written out on a blackboard for me, and we used an uppercase delta character \u0394 to denote a space as spaces are not always obvious when written.) I believe (but I am not entirely certain without checking) that the + signs are needed in front of both terms.<\/p>\n<div class=\"simple_likebuttons_container_small\">\r\n      <div class=\"simple_likebuttons_googleplus\">\r\n        <g:plusone size=\"medium\" count=\"false\" href=\"http:\/\/www.thefaberfamily.org\/search-smith\/2011\/12\/verity-to-solr-addendum\/\"><\/g:plusone>\r\n      <\/div>\r\n    \r\n      <div class=\"simple_likebuttons_twitter simple_likebuttons_twitter_s\">\r\n        <a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-count=\"none\" data-url=\"http:\/\/www.thefaberfamily.org\/search-smith\/2011\/12\/verity-to-solr-addendum\/\" data-lang=\"en\">Tweet<\/a>\r\n      <\/div>\r\n    \r\n      <div class=\"simple_likebuttons_facebook\">\r\n        <div id=\"fb-root\"><\/div>\r\n        <script>(function(d, s, id) {\r\n          var js, fjs = d.getElementsByTagName(s)[0];\r\n          if (d.getElementById(id)) {return;}\r\n          js = d.createElement(s); js.id = id;\r\n          js.src = \"\/\/connect.facebook.net\/en_US\/all.js#xfbml=1\";\r\n          fjs.parentNode.insertBefore(js, fjs);\r\n        }(document, \"script\", \"facebook-jssdk\"));<\/script>\r\n        <div class=\"fb-like\" data-href=\"http:\/\/www.thefaberfamily.org\/search-smith\/2011\/12\/verity-to-solr-addendum\/\" data-send=\"false\" data-layout=\"button_count\" data-show-faces=\"false\" data-width=\"90\"><\/div>\r\n      <\/div>\r\n    <\/div>","protected":false},"excerpt":{"rendered":"<p>One day into this blog and I&#8217;m already lying about upcoming posts! Seriously, I noticed reading over my first post that I had unintentionally left a couple of things out. The first is a postscript to the blog post I cited by ColdFusion Muse. This blog post dealt with some issues caused by using Solr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,3],"tags":[87,47,7,8,89,88,5],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-coldfusion","category-oracle","category-solr","tag-coldfusion","tag-integration","tag-java","tag-jvm","tag-oracle","tag-solr","tag-verity"],"_links":{"self":[{"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":10,"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":122,"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/posts\/25\/revisions\/122"}],"wp:attachment":[{"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.thefaberfamily.org\/search-smith\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}