Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:04:59+00:00 2026-06-13T05:04:59+00:00

We are using a solr index for various search applications. In most cases we

  • 0

We are using a solr index for various search applications. In most cases we use it just as you would with the admin interface.
for example:

+text:Mr +text:burns +publish_date[2012-09-10T00:00:00Z TO 2012-10-10T00:00:00Z]

This works fine.
My problem is that in one app we use complex lucene Queries directly against the index (without using solr) and in these queries i cant find how to search on a date field.
In schema.xml:

<field name="publish_date" type="date" indexed="true" stored="true"/>

It seems that solr stores the date as unix time in milliseconds, when pulling the field from the index it looks like that 1336867200000

In lucene I’ve tried every query I can think of:

TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "1299628800000", "1336867200000", true, true);
TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "1299628800", "1336867200", true, true);
TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "2012-09-10T00:00:00Z", "2012-10-10T00:00:00Z", true, true);
TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "20120910", "20121010", true, true);
NumericRangeQuery nq1 = NumericRangeQuery.newLongRange("publish_date", 1299628800, 1336867200, true, true);

and a few other tries…
The only query that did return results was

TermRangeQuery nq1 = new TermRangeQuery("publish_date",  null, null, true, true);

Of course this is a query with “Open endpoints” but it does seem to apply that the field is indexed as string (the same didn’t work with int-range or long-range).
The frustrating thing is that it is obviously possible, I just have to figure out how dose solr preforms it’s date range.
Anyone knows how to perform this search?
Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:05:00+00:00Added an answer on June 13, 2026 at 5:05 am

    The “1336867200000” is a timestamp, yes.

    TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "1299628800000", "1336867200000", true, true);
    TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "1299628800", "1336867200", true, true); 
    TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "2012-09-10T00:00:00Z", "2012-10-10T00:00:00Z", true, true); 
    TermRangeQuery nq1 = new TermRangeQuery("publish_date",  "20120910", "20121010", true, true);
    

    Above ones won’t work because you are using string parameter for numeric data.

    NumericRangeQuery nq1 = NumericRangeQuery.newLongRange("publish_date", 1299628800, 1336867200, true, true);
    

    This one wouldn’t work because you didn’t pad it with enough zeroes. 1299628800 stands for Fri Jan 16 02:00:28 GMT 1970.

    If you have document(s) dated between 09/03/2011 and 13/05/2012, the following should work:

    NumericRangeQuery nq1 = NumericRangeQuery.newLongRange("publish_date", 1299628800000L, 1336867200000L, true, true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're using Solr to search articles of various lengths. We index both descriptive metadata
I'm using Solr and Solr:Cell plugin to index and search rich text documents and
I am using solr search engine to query an index for classifieds that match
I am using Tika integrated in SOLR to index documents and allow search on
I am using solr to search through indices written through lucene's index writer. My
We are using Solr for it's full text search capability, lets say we are
What would be a good design for using Solr to search in complex JSON?
I am using Apache Solr for search. I use this to provide personal user-based
I am thinking of using solr to index the log files generated by applications
I'm using Solr for a realtime search index. My dataset is about 60M large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.