Quantcast

analyzed prefix filter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

analyzed prefix filter

daveey
is there a way to have prefix filter get analyzed? i want to somehow get

query: "hel wor" to match {name: "hello world"}

currently, i construct an {and: [{prefix: {name: "hel"}}, {prefix: {name: "wor"}}]}

but this means i have to tokenize the query myself. i'd love to use the same analyzer as i used for indexing.

i considered using the analyze API call to first get the tokens from the query, and then use them to construct the prefix clauses, but it would be nice to avoid the second roundtrip

thanks in advance for any ideas!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: analyzed prefix filter

Clinton Gormley-2
On Tue, 2013-02-26 at 18:26 -0800, daveey wrote:

> is there a way to have prefix filter get analyzed? i want to somehow get
>
> query: "hel wor" to match {name: "hello world"}
>
> currently, i construct an {and: [{prefix: {name: "hel"}}, {prefix: {name:
> "wor"}}]}
>
> but this means i have to tokenize the query myself. i'd love to use the same
> analyzer as i used for indexing.
>
> i considered using the analyze API call to first get the tokens from the
> query, and then use them to construct the prefix clauses, but it would be
> nice to avoid the second roundtrip

Best is just to avoid the prefix filter :)

Analyze your text with edge-ngrams or ngrams, and you can achieve the
same thing, but with more efficient queries.

Search this list for questions about ngrams - there are lots of threads
about how to use them

clint

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Loading...