In addition (I'm presuming you want to this numeric data so you can do range searching) be careful as you will hit the infamous, but rightfully designed, TooManyClauses exception.
See http://wiki.apache.org/lucene-java/LuceneFAQ#head-06fafb5d19e786a50fb3dfb882 1a6af9f37aa831 for details on how to address it. -- George Aroush -----Original Message----- From: Kainth, Sachin [mailto:[EMAIL PROTECTED] Sent: Friday, March 23, 2007 6:22 AM To: [email protected] Subject: RE: Numeric Comparison We've implemented numerical comparison here by using Lucene's string comparison facility as there does not seem to be any way that numbers can be compared in Lucene. However, you need to store the numbers in a specific way. In essence what we have done is store all numbers in left zero padded form. So for instance if we have two numbers 477 and 34345 in the index then we would store them as: 00000000477 00000034345 Then we would compare them against other values thus: Fieldname:{00000000100 TO 00000000500} The first of the two numbers in the index would pass the test but the second will not. It's a work around but it does the trick. There is also a way we have devised to support negative numbers as well but I can tell you that if you need it. Sachin -----Original Message----- From: rzr rzr [mailto:[EMAIL PROTECTED] Sent: 22 March 2007 17:36 To: [email protected] Subject: Numeric Comparison Hi, I've got a couple of questions. I'm posting them in two seperate mails to keep the subject headers relevant. Given: Relatively large databases that contain many records. Each database consists of a large file which may contain as much as 2M records. Each record consists of several fields, though exaclty what fields and how many of them may vary. The records are seperated by a NewLine/Cr/CrLf combination. The database contains GPS ranges. These ranges describe a small, rectengular slice of the earth. The numeric ranges are in a fixed field. Question: Using lucene .net, would it be possible to do a numeric comparison to test whether a %QueryValue% is smaller than, equal to or larger than the value in a all/any indexed GPS fields? This message has been scanned for viruses by MailControl - (see http://bluepages.wsatkins.co.uk/?6875772) This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding. The ultimate parent company of the Atkins Group is WS Atkins plc. Registered in England No. 1885586. Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18 5BW. Consider the environment. Please don't print this e-mail unless you really need to.
