Date: 2004-11-24T14:55:36
Editor: HossMan <[EMAIL PROTECTED]>
Wiki: Jakarta Lucene Wiki
Page: SearchNumericalFields
URL: http://wiki.apache.org/jakarta-lucene/SearchNumericalFields
no comment
Change Log:
------------------------------------------------------------------------------
@@ -22,6 +22,12 @@
doc.add(Field.Keyword("id", Number''''''Utils.pad(i)));
+ == Consider Using a Filter ==
+
+ Building a Query that for a number (or a range of numbers) is just like
building a Query for a word -- it involves scoring based on the frequency of
that word (or number) in the index which isn't usually what people want. So
you may want to consider "Filtering" using the RangeFilter class instead. It
can be a lot more efficient then using the RangeQuery class because it can skip
all of the score related issues.
+
+ http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&by=thread&from=943115
+
== Create a custom QueryParser subclass: ==
public class Custom''''''Query''''''Parser extends Query''''''Parser {
@@ -52,7 +58,7 @@
Note: Only the "id" field is treated special, but your logic may vary.
- == Use the custom QueryParser ==
+ === Use the custom QueryParser ===
Custom``Query''''''Parser parser =
new Custom''''''Query``Parser("field", analyzer);
@@ -63,7 +69,7 @@
query.toString("field"));
- == For decimals ==
+ == For decimals ==
You can use a multiplier to make sure you don't have decimals if they cause
problems.(comment by sv)
@@ -121,7 +127,7 @@
}
}}}
- === Handling larger numbers ===
+ == Handling larger numbers ==
The code for a class for handling all possible long values is here.
http://www.mail-archive.com/[email protected]/msg04790.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]