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. 

Reply via email to