Database LIKE 'something mor%' query


(Alexander Nemsadze) #1

We want to get elasticsearch to search for us exactly as database LIKE
'something mor%' query does and with highlights in particular case.
Any ideas?


(Baishampayan Ghose) #2

On Tue, Oct 11, 2011 at 6:10 PM, Alexander Nemsadze
alexander.nemsadze@azry.com wrote:

We want to get elasticsearch to search for us exactly as database LIKE
'something mor%' query does and with highlights in particular case.
Any ideas?

ElasticSearch supports "more like this" queries. More details -
http://www.elasticsearch.org/guide/reference/api/more-like-this.html

Regards,
BG

--
Baishampayan Ghose
b.ghose at gmail.com


(Chris Berkhout) #3

If you're just talking about finding things starting with a given string, like:

some_field LIKE 'something mor%'
some_field LIKE 'first second %'
some_field LIKE 'another cas%'

You should check out prefix queries:
http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html

Does that help?

Cheers,
Chris

On Tue, Oct 11, 2011 at 8:40 PM, Alexander Nemsadze
alexander.nemsadze@azry.com wrote:

We want to get elasticsearch to search for us exactly as database LIKE
'something mor%' query does and with highlights in particular case.
Any ideas?


(Karussell) #4

for best performance you'll need to use (edge)ngram filter/tokenizer
for indexing

http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/

http://www.elasticsearch.org/guide/reference/index-modules/analysis/edgengram-tokenfilter.html
http://www.elasticsearch.org/guide/reference/index-modules/analysis/ngram-tokenfilter.html

  • prefix query or 'something mor*' query_string queries

On 11 Okt., 14:40, Alexander Nemsadze alexander.nemsa...@azry.com
wrote:

We want to get elasticsearch to search for us exactly as database LIKE
'something mor%' query does and with highlights in particular case.
Any ideas?


(Alexander Nemsadze) #5

Unfortunately prefix works only for one word.

some_field LIKE 'somet%' - Works
some_field LIKE 'something mor%' - Does not work
some_field LIKE 'something more%' - Also does not work

On Oct 11, 4:48 pm, Chris Berkhout chrisberkh...@gmail.com wrote:

If you're just talking about finding things starting with a given string, like:

some_field LIKE 'something mor%'
some_field LIKE 'first second %'
some_field LIKE 'another cas%'

You should check out prefix queries:http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html

Does that help?

Cheers,
Chris

On Tue, Oct 11, 2011 at 8:40 PM, Alexander Nemsadze

alexander.nemsa...@azry.com wrote:

We want to get elasticsearch to search for us exactly as database LIKE
'something mor%' query does and with highlights in particular case.
Any ideas?


(Jürgen kartnaller) #6

On Tue, Oct 11, 2011 at 5:14 PM, Alexander Nemsadze <
alexander.nemsadze@azry.com> wrote:

Unfortunately prefix works only for one word.

I guess you shoud use a not analyzed field.

some_field LIKE 'somet%' - Works
some_field LIKE 'something mor%' - Does not work
some_field LIKE 'something more%' - Also does not work

On Oct 11, 4:48 pm, Chris Berkhout chrisberkh...@gmail.com wrote:

If you're just talking about finding things starting with a given string,
like:

some_field LIKE 'something mor%'
some_field LIKE 'first second %'
some_field LIKE 'another cas%'

You should check out prefix queries:
http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html

Does that help?

Cheers,
Chris

On Tue, Oct 11, 2011 at 8:40 PM, Alexander Nemsadze

alexander.nemsa...@azry.com wrote:

We want to get elasticsearch to search for us exactly as database LIKE
'something mor%' query does and with highlights in particular case.
Any ideas?

--
http://www.sfgdornbirn.at
http://www.mcb-bregenz.at


(system) #7