You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Areek Zillur (JIRA)" <ji...@apache.org> on 2015/07/30 02:47:05 UTC

[jira] [Comment Edited] (LUCENE-6702) [suggest] Make Context Query and Field extensible

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

Areek Zillur edited comment on LUCENE-6702 at 7/30/15 12:46 AM:
----------------------------------------------------------------

Thanks [~mikemccand] for the review!

{quote}
can you give some example use cases
to motivate opening things up via subclassing?
{quote}
An use-case for opening up ContextSuggestField#contexts() is to 
get context values from another field in a document. The 
field in question might not be present at context field creation time
(e.g. due to the field not being added yet) but can be accessed from the
document when it is being indexed. Opening up contexts() will allow 
sub-classes to steal the context values from the document at index-time.

After more thought, I have reverted opening up ContextQuery#convertAutomaton
via sub-classing, it has proven to be difficult to use. Originally, it was meant
such that sub-classes can modify the context automaton without having to 
worry about all the implementation details. 

{quote}  
saw some minor things:
+import java.util.*;
Could you fix your IDE to do keep each import separate? Thanks.
{quote}
Fixed the imports.

{quote}
I think toString is now not-so-friendly vs before, since we cutover to
IntsRef contexts key? (IntsRef.toString vs CharSequence.toString)
{quote}
Thanks for catching this, now it uses BytesRef.utf8ToString

Updated Patch:
 - make toString friendly, fix up imports
 - revert opening up ContextQuery#convertAutomaton


was (Author: areek):
Thanks [~mikemccand] for the review!

{quote}
can you give some example use cases
to motivate opening things up via subclassing?
{quote}
An use-case for opening up ContextSuggestField#contexts() is to 
get context values from another field in a document. The 
field in question might not be present at context field creation time
(e.g. due to the field not being added yet) but can be accessed from the
document when it is being indexed. Opening up contexts() will allow sub-classes to steal the context values from the document at index-time.
After more thought, I have reverted opening up ContextQuery#convertAutomaton
via sub-classing, it has proven to be difficult to use. Originally, it was meant
such that sub-classes can modify the context automaton without having to 
worry about all the implementation details. 

{quote}  
saw some minor things:
+import java.util.*;
Could you fix your IDE to do keep each import separate? Thanks.
{quote}
Fixed the imports.

{quote}
I think toString is now not-so-friendly vs before, since we cutover to
IntsRef contexts key? (IntsRef.toString vs CharSequence.toString)
{quote}
Thanks for catching this, now it uses BytesRef.utf8ToString

Updated Patch:
 - make toString friendly, fix up imports
 - revert opening up ContextQuery#convertAutomaton

> [suggest] Make Context Query and Field extensible
> -------------------------------------------------
>
>                 Key: LUCENE-6702
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6702
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/other
>    Affects Versions: Trunk
>            Reporter: Areek Zillur
>            Assignee: Areek Zillur
>             Fix For: Trunk
>
>         Attachments: LUCENE-6702.patch, LUCENE-6702.patch
>
>
> ContextSuggestField indexes context information along with 
> suggestions, which can be used to filter and/or boost suggestions using 
> ContextQuery.
> It would be useful to make ContextSuggestField extensible such that subclasses 
> can inject context values at index-time, without having to specify the 
> contexts in its ctor.
> ContextQuery can be made extensible by allowing sub-classes to override
> how context automaton is created from provided query contexts. 
> Currently, ContextQuery uses a context value of "*" to consider all context values, 
> It makes sense to have a dedicated {{addAllContexts()}} instead.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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