How to do partial matching on decimal numbers?


(Shane Witbeck) #1

I've run into an issue where search isn't returning a doc based on a
partial decimal number.

Here's an example:

For a doc with content "P 11.7.67093 BS in longevity test"

searching for 11.7 does not return the doc but searching for 11.7.67093
does.

Here's the search query: https://gist.github.com/2693957

Here's the mapping: https://gist.github.com/2693973

For the above example, the "P 11.7.67093 BS in longevity test" is in the
"subject" of an indexed doc.

How would I have the document returned on searches for 11.7?


(Igor Motov) #2

The standard analyzer treats "11.7.67093" as a single token, which doesn't
match "11.7", but you can use Prefix Queryhttp://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.htmlto find it.

You can also try switching to a different analyzer if you want 11.7.67093
to be treated as 3 separate tokens. The Pattern Analyzer might be a good
place to start.

On Monday, May 14, 2012 9:30:01 AM UTC-4, Shane Witbeck wrote:

I've run into an issue where search isn't returning a doc based on a
partial decimal number.

Here's an example:

For a doc with content "P 11.7.67093 BS in longevity test"

searching for 11.7 does not return the doc but searching for 11.7.67093
does.

Here's the search query: https://gist.github.com/2693957

Here's the mapping: https://gist.github.com/2693973

For the above example, the "P 11.7.67093 BS in longevity test" is in the
"subject" of an indexed doc.

How would I have the document returned on searches for 11.7?


(system) #3