This feels like an XY problem. Either you're working with numbers or you're not. It's hard for me to imagine what purpose is served by a query on numerical data that would match 2.5, 20.5, 299.5, 299999999999999.5 etc, much less regexes. That may just be my limited imagination however.
You could simply inject "synonyms" without the .0 in the same field though. Best, Erick On Mon, May 18, 2015 at 8:20 AM, Todd Long <lon...@gmail.com> wrote: > I'm having some normalization issues when trying to search decimal fields > (i.e. TrieDoubleField copied to TextField). > > 1. Wildcard searching: I created a separate "TextField" field type (e.g. > filter_decimal) which filters whole numbers to have at least one decimal > place (i.e. dot zero) using the pattern replace filter. When I build the > query I remove any extraneous zeros in the decimal (e.g. 235.000 becomes > 235.0) to make sure my wildcard search will match on the non-wildcard > decimal (hopefully that makes sense). I then build the wildcard query based > on the original input along with the extraneous zeros removed (see examples > below). Is this the best approach or does Solr allow me to go about this > another way? > > e.g. > input: 2*5.000 > query: filter_decimal:2*5.000* OR filter_decimal:2*5.0 > > e.g. > input: 235. > query: filter_decimal:235.* > > 2. Regex searching: When indexing decimal fields with a dot zero any regular > expressions that don't take that into account return no results (see example > below). The only way around this is by dropping the dot zero when indexing. > Of course, this now requires me to define another field type with an > appropriate pattern replace filter. I tried creating a query token filter > but by the time I get the term attribute I don't if the search was a regular > expression or not. Any ideas on this? Is it best to just create another > field type that removes the dot zero? > > e.g. /23[58]/ (will not match on 235.0) > > Please let me know if I can provide any additional details. Thanks for the > help! > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Wildcard-Regex-Searching-with-Decimal-Fields-tp4206015.html > Sent from the Solr - User mailing list archive at Nabble.com.