[ 
https://issues.apache.org/jira/browse/LUCENE-4518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488906#comment-13488906
 ] 

Michael McCandless commented on LUCENE-4518:
--------------------------------------------

Hmm... it could be that if we simply record the partial output (surface form) 
we've accumulated so far, when we add a start path into the TopNSearcher, that 
this could make a good hilite candidate.

The FST will always output "eagerly", meaning on seeing a given partial input, 
it will output as much as is unambiguously possible.  So I suspect the 
equivalent in Lucene of the "praefi" example would just work.

The only problem I can think of where this won't work is if the completion is 
[somewhat] deterministic.  EG if you only had added "electron" and 
"electronics" to your suggester, and user has typed only 'e' so far, the output 
on traversing only 'e' would be electron, which is way too much to hilite.  But 
in a "real" app, where there are tons and tons of suggestions, I suspect this 
would become a vanishingly minor issue.
                
> Suggesters: highlighting (explicit markup of user-typed portions vs. 
> generated portions in a suggestion)
> --------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-4518
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4518
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Oliver Christ
>
> As a user, I would like the lookup result of the suggestion engine to contain 
> information which allows me to distinguish the user-entered portion from the 
> autocompleted portion of a suggestion. That information can then be used for 
> e.g. highlighting. 
> *Notes:*
> It's trivial if the suggestion engine only applies simple prefix search, as 
> then the user-typed prefix is always a true prefix of the completion. 
> However, it's non-trivial as soon as you use an AnalyzingSuggester, where the 
> completion may (in extreme cases) be quite different from the user-provided 
> input. As soon as case/diacritics folding, script adaptation (kanji/hiragana) 
> come into play, the completion is no longer guaranteed to be an extension of 
> the query. Since the caller of the suggestion engine (UI) generally does not 
> know the implementation details, the required information needs to be passed 
> in the LookupResult.
> *Discussion on java-user:*
> > I haven't found a simple solution for the highlighting yet,
> > particularly when using AnalyzingSuggester (where it's non-trivial).
> Mike McCandless:
> Ahh I see ... it is challenging in that case.  Hmm.  Maybe open an issue for 
> this as well, so we can discuss/iterate?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to