:       i want to store dates into a date field called publish date in solr.
: how do we do it using solrj

I'm pretty sure that when indexing docs, you can add Date objects directly 
to the SolrInputDocument as field values -- but 'm not 100% certain (i 
don't use SolrJ much)

:       likewise how do we query from solr using java date? do we always have
: to convert it into UTC field and then query it?

all of the query APIs are based on query strings -- so yes you need to 
construct hte query string on your client side, and yes that includes 
formatting in UTC.

:       How do i query solr for documents published on monday or for documents
: published on March etc.

if you mean "march of any year" or "any monday ever" then there isn't any 
built in support for anything like that ... your best bet would either be 
to add "month_of_year" and "day_of_week" fields and populate them in your 
client code, or write an UpdateProcessor to run in solr (that could be 
pretty generic if you wnat ot contribute it back, other people could find 
it useful)

If you mean "published in the most recent march" or "published on hte 
most recent monday" where you don't have to change anything to have the 
query "do what i mean" as time moves on then you'd either need to do that 
when building up your query, or write it as a QParser plugin.

:       or in that case even apply range queries on it??

basic range queries are easy...

http://wiki.apache.org/solr/SolrQuerySyntax
http://lucene.apache.org/solr/api/org/apache/solr/schema/DateField.html



-Hoss

Reply via email to