lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uwe Schindler <>
Subject Re: How to Perform a Full Text Search on a Number with Leading Zeros or Decimals?
Date Fri, 28 Jun 2013 19:39:42 GMT
You can add PatternReplaceFilter (
to replace the tokens only consisting of digits by their vsrisnt with leading zeroes removed.


Jack Krupansky <> schrieb:
>The user could use a regular expression query to match the numbers, but
>otherwise, you will have to write some specialized token filter to
>numeric tokens and generate extra tokens at the same position for each
>variant that you want to search for.
>-- Jack Krupansky
>-----Original Message----- 
>From: Todd Hunt
>Sent: Friday, June 28, 2013 2:18 PM
>Subject: How to Perform a Full Text Search on a Number with Leading
>Zeros or 
>I have an application that is indexing the text from various reports
>forms that are generated from our core system.  The reports will
>dollar amounts and various indexes that contain all numbers, but have 
>leading zeros.
>If a document contains that following text that is stored in one Lucene
>document field:
>"Account 00000012345 owes $321.98"
>What analyzer can be used to index this text and allow the user to find
>document by searching on:
>We are currently using a StandardAnalyzer which works well for most of
>use cases, but not one like this.
>I realize that I could create my own token filter to convert any text
>can be represented by an Integer or Long, with leading zeros or not,
>convert the value to a normal looking integer without leading zeros. 
>I'd prefer to reuse and existing analyzer or technique to achieve the
>Thank you.
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Uwe Schindler
H.-H.-Meier-Allee 63, 28213 Bremen
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message