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 Pranav Prakash <pr...@gmail.com> on 2011/09/27 15:53:30 UTC

Can't use ms() function on non-numeric legacy date field

Hi, I had been trying to boost my recent documents, using what is described
here http://wiki.apache.org/solr/FunctionQuery#Date_Boosting

My date field looks like

<fieldType name="date" class="solr.DateField" sortMissingLast="true"
omitNorms="true"/>
<field name="created_at" type="date" indexed="true" stored="true" omitNorms
="true"/>

However, upon trying to do ms(NOW, created_at) it shows the error
Can't use ms() function on non-numeric legacy date field created_at
*
*
*Pranav Prakash*

"temet nosce"

Twitter <http://twitter.com/pranavprakash> | Blog <http://blog.myblive.com> |
Google <http://www.google.com/profiles/pranny>

Re: Can't use ms() function on non-numeric legacy date field

Posted by Chris Hostetter <ho...@fucit.org>.
: Try solr.TrieDateField instead

and note the docs on the "ms" function, from the same wiki page you linked 
to...

>> Arguments may be numerically indexed date fields such as TrieDate 
>> (recommended field type for dates since Solr 1.4), or date math 
>> (examples in SolrQuerySyntax) based on a constant date or NOW.
>> 
>> Things other than these will _not_ work as arguments. For example, you 
>> cannot currently use:
>>  * "classic", non-numerically indexed date fields (i.e. fields backed 
>>     by DateField or LegacyDateField classes) 
>>  * other functions (e.g. map, sum, etc.) 


-Hoss

Re: Can't use ms() function on non-numeric legacy date field

Posted by Markus Jelsma <ma...@openindex.io>.
Try solr.TrieDateField instead


On Tuesday 27 September 2011 15:53:30 Pranav Prakash wrote:
> Hi, I had been trying to boost my recent documents, using what is described
> here http://wiki.apache.org/solr/FunctionQuery#Date_Boosting
> 
> My date field looks like
> 
> <fieldType name="date" class="solr.DateField" sortMissingLast="true"
> omitNorms="true"/>
> <field name="created_at" type="date" indexed="true" stored="true" omitNorms
> ="true"/>
> 
> However, upon trying to do ms(NOW, created_at) it shows the error
> Can't use ms() function on non-numeric legacy date field created_at
> *
> *
> *Pranav Prakash*
> 
> "temet nosce"
> 
> Twitter <http://twitter.com/pranavprakash> | Blog <http://blog.myblive.com>
> | Google <http://www.google.com/profiles/pranny>

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350