Return-Path: Delivered-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Received: (qmail 29677 invoked from network); 18 Oct 2009 22:30:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Oct 2009 22:30:35 -0000 Received: (qmail 61396 invoked by uid 500); 18 Oct 2009 22:30:35 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 61320 invoked by uid 500); 18 Oct 2009 22:30:35 -0000 Mailing-List: contact solr-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-commits@lucene.apache.org Received: (qmail 61300 invoked by uid 99); 18 Oct 2009 22:30:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Oct 2009 22:30:34 +0000 X-ASF-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Oct 2009 22:30:32 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 2F88C19A64 for ; Sun, 18 Oct 2009 22:30:12 +0000 (GMT) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Sun, 18 Oct 2009 22:30:12 -0000 Message-ID: <20091018223012.4716.36097@eos.apache.org> Subject: =?utf-8?q?=5BSolr_Wiki=5D_Update_of_=22SolrRelevancyFAQ=22_by_YonikSeeley?= Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for chan= ge notification. The "SolrRelevancyFAQ" page has been changed by YonikSeeley. The comment on this change is: add full examples of date boosting. http://wiki.apache.org/solr/SolrRelevancyFAQ?action=3Ddiff&rev1=3D13&rev2= =3D14 -------------------------------------------------- * Do an explicit sort by date (relevancy scores are ignored) * Use an index-time boost that is larger for newer documents * Use a FunctionQuery to influence the score based on a date field. - Use something of the form recip(rord(myfield),1,1000,1000) + * In Solr 1.3, use something of the form recip(rord(myfield),1,1000,1= 000) + * In Solr 1.4, use something of the form recip(ms(NOW,mydatefield),3.= 16e-11,1,1) - http://lucene.apache.org/solr/api/org/apache/solr/search/function/Rec= iprocalFloatFunction.html + http://lucene.apache.org/solr/api/org/apache/solr/search/function/Recip= rocalFloatFunction.html + = + http://lucene.apache.org/solr/api/org/apache/solr/search/BoostQParserPl= ugin.html + = + A full example of a query for "ipod" with the score boosted higher the ne= wer the product is: + {{{ + http://localhost:8983/solr/select?q=3D{!boost b=3Drecip(ms(NOW,manufactur= edate_dt),3.16e-11,1,1)}ipod + }}} + = + One can simplify the implementation by decomposing the query into multipl= e arguments: + {{{ + http://localhost:8983/solr/select?q=3D{!boost b=3D$dateboost v=3D$qq}&dat= eboost=3Drecip(ms(NOW,manufacturedate_dt),3.16e-11,1,1)&qq=3Dipod + }}} + = + Now the main "q" argument as well as the "dateboost" argument may be spec= ified as defaults in a search handler in solrconfig.xml, and clients would = only need to pass "qq", the user query. + = = =3D=3D How do I give a very low boost to documents that match my query = =3D=3D In general the problem is that a "low" boost is still a boost, it can onl= y improve the score of documents that match. One way to fake a "negative bo= ost" is to give a high boost to everything that does *not* match. For examp= le: