You can just use "NOW/DAY" for a filter that would only change once a day:

[NOW/DAY-60DAY TO NOW/DAY]

Oops... make that:

[NOW/DAY-60DAY TO NOW/DAY+1DAY]

Otherwise, it would miss dates after the start of today.

Even better, make it:

[NOW/DAY-60DAY TO *]

-- Jack Krupansky

-----Original Message----- From: Kamal Palei
Sent: Thursday, May 30, 2013 5:41 AM
To: solr-user@lucene.apache.org
Subject: Re: Sorting results by last update date

Thanks Shalini...
It is solr 3.6.2
Instead of NOW, I can use today's date.... (I did not know this cache
issue,, thanks).

Later I realized , it looks it is my mistake that misleads asc and desc
ordering result.
After I get data from solr, again I do mysql query where the order changes
again.

Regards
Kamal


On Wed, May 29, 2013 at 2:54 PM, Shalin Shekhar Mangar <
shalinman...@gmail.com> wrote:

On Wed, May 29, 2013 at 12:10 PM, Kamal Palei <palei.ka...@gmail.com>
wrote:

> Hi All
> I am trying to sort the results as per last updated date. My url looks > as
> below.
>
> *&fq=last_updated_date:[NOW-60DAY TO NOW]&fq=experience:[0 TO
> 588]&fq=salary:[0 TO 500] OR
>
>
salary:0&fq=-bundle:job&fq=-bundle:panel&fq=-bundle:page&fq=-bundle:article&spellcheck=true&q=+java
>
>
+sip&fl=id,entity_id,entity_type,bundle,bundle_name,label,is_comment_count,ds_created,ds_changed,score,path,url,is_uid,tos_name,zm_parent_entity,ss_filemime,ss_file_entity_title,ss_file_entity_url,ss_field_uid&spellcheck.q=+java
>
>
+sip&qf=content^40&qf=label^5.0&qf=tos_content_extra^0.1&qf=tos_name^3.0&hl.fl=content&mm=1&q.op=AND&wt=json&
> json.nl=map&sort=last_updated_date asc
> *
> With this I get the data in ascending order of last updated date.
>
> If I am trying to sort data in descending order, I use below url
>
> *&fq=last_updated_date:[NOW-60DAY TO NOW]&fq=experience:[0 TO
> 588]&fq=salary:[0 TO 500] OR
>
>
salary:0&fq=-bundle:job&fq=-bundle:panel&fq=-bundle:page&fq=-bundle:article&spellcheck=true&q=+java
>
>
+sip&fl=id,entity_id,entity_type,bundle,bundle_name,label,is_comment_count,ds_created,ds_changed,score,path,url,is_uid,tos_name,zm_parent_entity,ss_filemime,ss_file_entity_title,ss_file_entity_url,ss_field_uid&spellcheck.q=+java
>
>
+sip&qf=content^40&qf=label^5.0&qf=tos_content_extra^0.1&qf=tos_name^3.0&hl.fl=content&mm=1&q.op=AND&wt=json&
> json.nl=map&sort=last_updated_date desc*
>
> Here the data set is not ordered properly, mostly it looks to me data is
> ordered on basis of score, not last updated date.
>
> Can somebody tell me what I am missing here, why *desc* is not working
> properly for me.
>
>
What is the field type of last_update_date? Which version of Solr?

A side note: Using NOW in a filter query is ineffecient because it doesn't
use your filter cache effectively. Round it to nearest time interval
instead. See http://java.dzone.com/articles/solr-date-math-now-and-filter

--
Regards,
Shalin Shekhar Mangar.


Reply via email to