You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Stadler Hans-Christian <ha...@psi.ch> on 2007/05/11 18:16:13 UTC
Numerical fields
Is there an enhancment/plugin to Lucene which would allow
queries like
myNumericalField > 100
I know that usually one has to index such fields as text with
the property a > b => lex(text(a)) > lex(text(b)) and devise
the text(n) transformation appropriately.
What I'm looking for is an enhancement which would eliminate
the a -> text(a) transformation or simplify it. Is it necessary f.ex.
to implement the above query as a range query
100 <= myNumericalField <= 999999999999999999999999.....
Since many people use numeric field, I guess there exists some
enhancement allready that simplifz the treatment of numerical fields.
HC
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Numerical fields
Posted by Chris Hostetter <ho...@fucit.org>.
: I know that usually one has to index such fields as text with
: the property a > b => lex(text(a)) > lex(text(b)) and devise
: the text(n) transformation appropriately.
:
: What I'm looking for is an enhancement which would eliminate
: the a -> text(a) transformation or simplify it. Is it necessary f.ex.
the transformation has to happen either way, so the best we can do is
create it and put it in a utility ... NumberTools already meets this need
for longs, but there are some other utils in Solr that could be promoted
if someone wants to do so.
: to implement the above query as a range query
:
: 100 <= myNumericalField <= 999999999999999999999999.....
that's just not true ... ConstantScoreRangeQuery can support open ended
ranges -- there is no need to specify an artificial uper bound.
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Numerical fields
Posted by Doron Cohen <DO...@il.ibm.com>.
karl wettin wrote:
>
> 11 maj 2007 kl. 18.16 skrev Stadler Hans-Christian:
>
> > Is there an enhancment/plugin to Lucene which would allow
> > queries like
> >
> > myNumericalField > 100
>
> FunctionQuery might be what you are looking for.
>
> http://issues.apache.org/jira/browse/LUCENE-446
LUCENE-446 allows also score manipulation. It can also be
used to filter docs by assigning 0 score to out-of-range
docs.
But note two aspects of using search.function: (1) values
cannot exceed Integer.MAX_VALUE. (some examples given
here had larger values...) (2) all values are loaded
(once, cached) into memory, so expect RAM usage of
numDocs * 1/2/4/8 bytes, depending on the maximal
needed value.
A user discussion that may be relevant:
http://www.mail-archive.com/java-user@lucene.apache.org/msg11965.html
>
> --
> karl
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Numerical fields
Posted by karl wettin <ka...@gmail.com>.
11 maj 2007 kl. 18.16 skrev Stadler Hans-Christian:
> Is there an enhancment/plugin to Lucene which would allow
> queries like
>
> myNumericalField > 100
FunctionQuery might be what you are looking for.
http://issues.apache.org/jira/browse/LUCENE-446
--
karl
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org