Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggest api enhancement #3199

Closed
rkarakaya opened this issue Jun 18, 2013 · 8 comments
Closed

suggest api enhancement #3199

rkarakaya opened this issue Jun 18, 2013 · 8 comments

Comments

@rkarakaya
Copy link

Hi,

I want to build a custom suggester and plug it into the existing suggest API.
The problem I am facing is that the current suggester extension api dont let me to do my job.

I need to access:

  • searcher
  • index
  • shardId

Current API expose parameters only needed by built-in phrase and term suggester :-(

thanks.
.

@s1monw
Copy link
Contributor

s1monw commented Jun 18, 2013

At this point we already have an extension mechanism for this in place added in #3089 You have access to the searcher or rather to the index reader which is what you want at the end of the day. I am happy to expose the shard and the index as well, can you explain the usecase a bit more?

@rkarakaya
Copy link
Author

Current Suggester.java execute API as fallows:

public Suggestion<? extends Entry<? extends Option>> execute(String name, T suggestion, IndexReader indexReader, CharsRef spare) throws IOException;

For example, at this point, I need searcher rather than reader.

My customer wanted me to build a suggester that supports:

  • highlight matched tokens
  • phrase suggestion.
  • a few concrete product suggestions at the end of the suggested items list.

As far as I understand, current phrase suggester does not support AND search.
I mean, for instance it prompted "word1 word2" but no such document exists in my index that contains both words suggested. May be I am missing something:-)

Also, my customer wants to see more words other than what user typed and simple corrections. ,
So, I decided to build my own suggester using faceting on a field that contains shingles.

I can create totaly a new rest endpoint for my suggester but it would be awesome to plug it into the existing ES architecture.

@s1monw
Copy link
Contributor

s1monw commented Jun 18, 2013

For example, at this point, I need searcher rather than reader.

you can simply call new IndexSearcher(reader); The seacher is a lightweight wrapper around the reader.

@rkarakaya
Copy link
Author

Thank you Simon.. I didn't know that..

is it possible for you to extend SuggestionContext so that it contains index and shard info as well?

@s1monw
Copy link
Contributor

s1monw commented Jun 18, 2013

is it possible for you to extend SuggestionContext so that it contains index and shard info as well?

yeah I think this makes sense! I will do that

@rkarakaya
Copy link
Author

thank you very much..

@s1monw s1monw closed this as completed in c9c68fc Jun 18, 2013
@s1monw
Copy link
Contributor

s1monw commented Jun 18, 2013

I have't ported this to 0.90 yet since I am waiting for #3089 to get ported... I will revisit this once we are done portin

s1monw added a commit that referenced this issue Sep 27, 2013
Suggesters might need access to the shard they run on as well as the
index they operate on. This patch adds indexname and shard ID to the
SuggestionContext

Closes #3199
@s1monw
Copy link
Contributor

s1monw commented Sep 27, 2013

backported to 0.90

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Suggesters might need access to the shard they run on as well as the
index they operate on. This patch adds indexname and shard ID to the
SuggestionContext

Closes elastic#3199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants