ultimately, everything is text search. For decimal number, what you do is to write a customized analyzer which multiple the number by some factor, round it to a long and then use NumberTools to convert that into a text string. Here is what I did for latitude/longitude search: multiple it by 10e6.
john ----- Original Message ---- From: Jiho Han <[EMAIL PROTECTED]> To: java-user@lucene.apache.org Sent: Wednesday, January 17, 2007 10:13:47 AM Subject: Searching/indexing date/time values or numeric values? Is there a way to index/search so that a query could be written to search on a field using arithmetic comparison operators? What I mean is if I had a date/time field called CREATEDATE, I would search for all documents where: CREATEDATE > "1/1/2007" The above is obvisouly pseudo-query expression. I did find something called Range searches on the query syntax documentation page and it says the sorting is done lexicographically. I guess that means it's sorted by letter. I would then need to store all my date/time values in a format like yyyymmdd hh:mm:ss. And search, CREATEDATE:[20070101 00:00:00 TO 20070118 00:00:00], where the second date/time value is something like midnight tonight. But what about a decimal value? If I have a VERSION field where values are like 1.0, 2.5, 11.3, etc. That wouldn't work. Because the values would be sorted: 1.0 11.3 2.5 In that order. And if I do VERSION:[1.0 TO 3.0], search would return all 3 of them. The only workaround seems to be prepending 0's and that would also only work as long as the maximum digits for the interger part is known ahead of time. Can someone verify/suggest ways to make this work? Thanks Jiho Han Senior Software Engineer Infinity Info Systems The Sales Technology Experts Tel: 212.563.4400 x6375 Fax: 212.760.0540 [EMAIL PROTECTED] www.infinityinfo.com <http://www.infinityinfo.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ____________________________________________________________________________________ Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]