You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Shawn Heisey <so...@elyograg.org> on 2010/08/17 18:40:11 UTC

Re: Solr date "NOW" - format?

  On 4/9/2010 7:35 PM, Lance Norskog wrote:
> Function queries are notoriously slow. Another way to boost by year is
> with range queries:
> [NOW-6MONTHS TO NOW]^5.0 ,
> [NOW-1YEARS TO NOW-6MONTHS]^3.0
> [NOW-2YEARS TO NOW-1YEARS]^2.0
> [* TO NOW-2YEARS]^1.0
>
> Notice that you get to have a non-linear curve when you select the
> ranges by hand.

Lance, I have worked out my major issue and now have my post date in 
Solr as a tdate field named "pd."  I cannot however figure out how to 
actually send a query with a date boost like you've mentioned above.  
I'd like to embed it right into the dismax handler definition, but it 
would be good to also know how to send it in a query myself.  Can you help?

Are the boosts indicated above a multiplier, or an addition?

Thanks,
Shawn


Re: Solr date "NOW" - format?

Posted by Shawn Heisey <so...@elyograg.org>.
  My first attempt was adding this to the dismax handler:

<str name="bq">pd:[NOW-1MONTH TO NOW]^5.0</str>
<str name="bq">pd:[NOW-3MONTHS TO NOW-1MONTH]^3.0</str>
<str name="bq">pd:[NOW-1YEAR TO NOW-3MONTHS]^2.0</str>
<str name="bq">pd:[* TO NOW-1YEAR]^1.0</str>

This results in scores that are quite a bit lower (9.5 max score instead 
of 11.7), but the order looks the same.  No real change other than a 
higher max score (10) if I leave only the first bq entry.

I wasn't able to figure out a way to put all the ranges in one bq, 
everything I tried got zero results.

What am I doing wrong?


On 8/17/2010 8:36 PM, Shawn Heisey wrote:
>  Would I do separate bq values for each of the ranges, or is there a 
> way to include them all at once?  If it's the latter, I'll need a full 
> example with a field name, because I'm clueless. :)
>
> On 8/17/2010 2:29 PM, Lance Norskog wrote:
>> I think 'bq=' is what you want. In dismax the main query string is
>> assumed to go against a bunch of fields. This query is in the standard
>> (Lucene++) format. The query strings should handle the ^number syntax.
>>
>> http://www.lucidimagination.com/search/document/CDRG_ch07_7.4.2.9
>>
>> On Tue, Aug 17, 2010 at 9:40 AM, Shawn Heisey<so...@elyograg.org>  wrote:
>>>   On 4/9/2010 7:35 PM, Lance Norskog wrote:
>>>> Function queries are notoriously slow. Another way to boost by year is
>>>> with range queries:
>>>> [NOW-6MONTHS TO NOW]^5.0 ,
>>>> [NOW-1YEARS TO NOW-6MONTHS]^3.0
>>>> [NOW-2YEARS TO NOW-1YEARS]^2.0
>>>> [* TO NOW-2YEARS]^1.0
>>>>
>>>> Notice that you get to have a non-linear curve when you select the
>>>> ranges by hand.
>>> Lance, I have worked out my major issue and now have my post date in 
>>> Solr as
>>> a tdate field named "pd."  I cannot however figure out how to 
>>> actually send
>>> a query with a date boost like you've mentioned above.  I'd like to 
>>> embed it
>>> right into the dismax handler definition, but it would be good to 
>>> also know
>>> how to send it in a query myself.  Can you help?
>>>
>>> Are the boosts indicated above a multiplier, or an addition?
>


Re: Solr date "NOW" - format?

Posted by Shawn Heisey <so...@elyograg.org>.
  Would I do separate bq values for each of the ranges, or is there a 
way to include them all at once?  If it's the latter, I'll need a full 
example with a field name, because I'm clueless. :)

On 8/17/2010 2:29 PM, Lance Norskog wrote:
> I think 'bq=' is what you want. In dismax the main query string is
> assumed to go against a bunch of fields. This query is in the standard
> (Lucene++) format. The query strings should handle the ^number syntax.
>
> http://www.lucidimagination.com/search/document/CDRG_ch07_7.4.2.9
>
> On Tue, Aug 17, 2010 at 9:40 AM, Shawn Heisey<so...@elyograg.org>  wrote:
>>   On 4/9/2010 7:35 PM, Lance Norskog wrote:
>>> Function queries are notoriously slow. Another way to boost by year is
>>> with range queries:
>>> [NOW-6MONTHS TO NOW]^5.0 ,
>>> [NOW-1YEARS TO NOW-6MONTHS]^3.0
>>> [NOW-2YEARS TO NOW-1YEARS]^2.0
>>> [* TO NOW-2YEARS]^1.0
>>>
>>> Notice that you get to have a non-linear curve when you select the
>>> ranges by hand.
>> Lance, I have worked out my major issue and now have my post date in Solr as
>> a tdate field named "pd."  I cannot however figure out how to actually send
>> a query with a date boost like you've mentioned above.  I'd like to embed it
>> right into the dismax handler definition, but it would be good to also know
>> how to send it in a query myself.  Can you help?
>>
>> Are the boosts indicated above a multiplier, or an addition?


Re: Solr date "NOW" - format?

Posted by Lance Norskog <go...@gmail.com>.
I think 'bq=' is what you want. In dismax the main query string is
assumed to go against a bunch of fields. This query is in the standard
(Lucene++) format. The query strings should handle the ^number syntax.

http://www.lucidimagination.com/search/document/CDRG_ch07_7.4.2.9

On Tue, Aug 17, 2010 at 9:40 AM, Shawn Heisey <so...@elyograg.org> wrote:
>  On 4/9/2010 7:35 PM, Lance Norskog wrote:
>>
>> Function queries are notoriously slow. Another way to boost by year is
>> with range queries:
>> [NOW-6MONTHS TO NOW]^5.0 ,
>> [NOW-1YEARS TO NOW-6MONTHS]^3.0
>> [NOW-2YEARS TO NOW-1YEARS]^2.0
>> [* TO NOW-2YEARS]^1.0
>>
>> Notice that you get to have a non-linear curve when you select the
>> ranges by hand.
>
> Lance, I have worked out my major issue and now have my post date in Solr as
> a tdate field named "pd."  I cannot however figure out how to actually send
> a query with a date boost like you've mentioned above.  I'd like to embed it
> right into the dismax handler definition, but it would be good to also know
> how to send it in a query myself.  Can you help?
>
> Are the boosts indicated above a multiplier, or an addition?
>
> Thanks,
> Shawn
>
>



-- 
Lance Norskog
goksron@gmail.com