[
https://issues.apache.org/jira/browse/LUCENE-4906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13630207#comment-13630207
]
Robert Muir commented on LUCENE-4906:
-------------------------------------
Well i didnt try many possibilities, just played for an hour. So more
exploration and ideas would be good.
but here was my high level idea:
If we look at PostingsHighlighter, it has 'simple' methods and 'advanced'
methods:
{code}
/** simple */
String[] highlight(String field, Query query, IndexSearcher searcher, TopDocs
topDocs);
/** advanced */
Map<String,String[]> highlightFields(String fieldsIn[], Query query,
IndexSearcher searcher, int[] docidsIn, int maxPassagesIn[]);
{code}
I think its important that the simple methods remain simple... but it would be
good for 'advanced' users to have formatters that return maybe some more
complex stuff.
I think there are a few ways that could be done:
# internally formatter returns Object, and the simple methods call toString()
# generics :( Unfortunately to me generics are never simple...
# bite the bullet and change all method signatures to return some kind of
different "result" structure. Maybe this could be done in a way that even
simplifies the 'simple' signatures, e.g. maybe its confusing that this thing
returns an array in parallel to your topdocs today..
# other ideas...
In general I also think a nice baby step to making this more flexible is
LUCENE-4896. This would be a good one to do first, and i think its much easier
and an obvious win!
> PostingsHighlighter's PassageFormatter should allow for rendering to
> arbitrary objects
> --------------------------------------------------------------------------------------
>
> Key: LUCENE-4906
> URL: https://issues.apache.org/jira/browse/LUCENE-4906
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Michael McCandless
>
> For example, in a server, I may want to render the highlight result to
> JsonObject to send back to the front-end. Today since we render to string, I
> have to render to JSON string and then re-parse to JsonObject, which is
> inefficient...
> Or, if (Rob's idea:) we make a query that's like MoreLikeThis but it pulls
> terms from snippets instead, so you get proximity-influenced salient/expanded
> terms, then perhaps that renders to just an array of tokens or fragments or
> something from each snippet.
--
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: [email protected]
For additional commands, e-mail: [email protected]