Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr fetching date ranges

Tags:

solr

Well, i'm coding some methods for returning solr docs that mach a interval date range. Docs stored date fields with ISO 8601 format.

Any idea?

thx

like image 928
Lici Avatar asked Apr 28 '09 08:04

Lici


People also ask

How do I query a date range in SOLR?

That is you can form queries like q=field:[2000-11-01 TO 2014-12-01] or q=field:2000-11. It supports indexing a date range in a single field. For instance a field in a document could be added to a document in SolrJ as solrInputDocument.

What are dynamic fields in Solr?

Dynamic fields allow Solr to index fields that you did not explicitly define in your schema. This is useful if you discover you have forgotten to define one or more fields. Dynamic fields can make your application less brittle by providing some flexibility in the documents you can add to Solr.

What is field type in SOLR?

A field type defines the analysis that will occur on a field when documents are indexed or queries are sent to the index. A field type definition can include four types of information: The name of the field type (mandatory). An implementation class name (mandatory).


1 Answers

Check in the SOLR wiki for some docs and examples:

timestamp:[* TO NOW]

createdate:[1976-03-06T23:59:59.999Z TO *]

createdate:[1995-12-31T23:59:59.999Z TO 2007-03-06T00:00:00Z]

pubdate:[NOW-1YEAR/DAY TO NOW/DAY+1DAY]

createdate:[1976-03-06T23:59:59.999Z TO 1976-03-06T23:59:59.999Z+1YEAR]

createdate:[1976-03-06T23:59:59.999Z/YEAR TO 1976-03-06T23:59:59.999Z]

Hope this helps, David.

like image 153
David Santamaria Avatar answered Oct 06 '22 00:10

David Santamaria