I think you should search the archive for DateTools. There have been very extensive discussions of this topic that will give you answers far more quickly.
Dates are strings in Lucene. There's no magic here. You don't need to override anything to get them to work, all you need to do is make sure that you index and query for them as searchable strings. For example, 20070122. If you have different formats for dates, decide on an underlying format that allows them to be sorted lexically (that is, by String comparison). Inspect your index with Luke to see if they're being stored as you expect. Use QueryParser.toString to see how the query string is broken up. Don't override anything until you do this or you'll waste much effort <G>. Best Erick On 3/5/07, Mohammad Norouzi <[EMAIL PROTECTED]> wrote:
Hi you know, actually we dont indexed this field as Date. we always use string instead of Date type because we use both Hijri date and Gregorian date so if we put a Hijri date the DateField not work properly. that is why we index such this field as String. as I read the javadoc for QueryParser, it is said to inherits a class from QueryParser and override its setQueryRange() method. I think in my case I should do it. what do you think? On 3/5/07, Chris Hostetter <[EMAIL PROTECTED]> wrote: > > > : > I even removed "/" from my query but still not working good. > : > Do I have to index dates issues without "/"? > : > now in the index I have 1978/05/05 should I change it to 19780505? > : > : Unless I'm mistaken (and it's been ages since I looked at the date stuff > : myself) this sort of thing only works if you use DateField to format the > : field values. > > correct ... please consult the class level javadocs for the QUeryParser > which talk somewhat extensively about dates in range queries nad using > DateField vs DateTools. > > in general, if searhing on "admitDate:1978/05/05" is working ofr you, then > a range search with the same format probably won't work for you ... > becuase when query parser sees a the range syntax on something that it can > parse as a date, it's going to expect the indexed format to be in a very > specific format .. you have a lot of control over what format it expects, > but "1978/05/05" isn't one of them. > > looking at the query.toString() from the QueryParser result will help you > understand what it's trying to search on. > > > -Hoss > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Regards, Mohammad
