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.