spinscale / elasticsearch-suggest-plugin

Plugin for elasticsearch which uses the lucene FSTSuggester
203 stars 42 forks source link

Is it able to search suggestion for all suggest-enabled fields? #1

Closed RaveNoX closed 12 years ago

RaveNoX commented 12 years ago

{ "field": "_all.suggest", "term": "test" }

Not get any suggestion. It needer for example search in blog post where suggestion must return words from title and from post body

spinscale commented 12 years ago

Hi,

as you can specify an analyzer for the _all field, you could put a shingle analyzer on it and just query "_all" instead of "_all.suggest"... Querying the _all field should not be a problem.

I should definately include a test for that.

--Alexander

RaveNoX commented 12 years ago

i can't set shingle analyzer for _all field because it using for stemmed search =/

ok, is any way to search suggestion on two (or more) fields in one query?

spinscale commented 12 years ago

currently it is not possible to query more fields in one query.

This could be implemented though.

How do you imagine the query?

{"fields" : { "a.suggest", "b.suggest", "term": "foo" }}

What should should the response be like? Simply merge the two results and return them?

RaveNoX commented 12 years ago

{"fields" : [ "a.suggest", "b.suggest", "term": "foo" ] }

result must be a distinct merge of resutls

spinscale commented 12 years ago

Whoops, wrong request... should be

{ "fields": [ "a.suggest", "b.suggest" ], "term" : "foo" }

Single query should still work like this

{ "field": "a.suggest", "term" : "foo" }

spinscale commented 12 years ago

When thinking about multi field queries. What speaks against merging this queries on client side? There is no performance gain on server side or do you know something like that in lucene?

spinscale commented 12 years ago

Closing this issue (which discussion has nothing to do with the original request, as query the _all field is working as expected, and even now featured with a test).

This does not need to be done on serverside, but rather is a client side job of merging two different results into one.