Todd Long
2015-05-18 15:20:34 UTC
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.
(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.