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

David vandendriessche edited comment on LUCENE-4043 at 1/21/13 9:39 AM:
------------------------------------------------------------------------

I'm trying to figure out how I can use the JoinUtil class in the plugin. I've 
already added it to my config and it seems to get registered. But I can't 
figure out how to get the indexSearcher in the TestParser? I know I'm using a 
predefined query.

public class TestParserPlugin extends QParserPlugin {

    @Override
    public QParser createParser(String string, SolrParams sp, SolrParams sp1, 
SolrQueryRequest sqr) {
        return new TestParser(string, sp1, sp1, sqr);
    }

    @Override
    public void init(NamedList nl) {
        
    }
 
    public class TestParser extends QParser{

        public TestParser(String qstr, SolrParams localParams, SolrParams 
params, SolrQueryRequest req) {
            super(qstr, localParams, params, req);
        }

        
        
        @Override
        public org.apache.lucene.search.Query parse() throws 
org.apache.lucene.queryparser.classic.ParseException {
            try {
                return JoinUtil.createJoinQuery("pageId", true, "fileId", new 
Query() {

                    @Override
                    public String toString(String string) {
                       return "pageTxtt:test";
                    }
                }, null, ScoreMode.Avg);//the null is the parameter I don't 
know how to get in the parser!
            } catch (IOException ex) {
                
Logger.getLogger(TestParserPlugin.class.getName()).log(Level.SEVERE, null, ex);
            }
            return null;
        }
    }
}
                
      was (Author: davidvdd):
    I'm trying to figure out how I can use the JoinUtil class in the plugin. 
I've already added it to my config and it seems to get registered. But I can't 
figure out how to get the indexSearcher in the TestParser? I know I'm using a 
predefined query.

public class TestParserPlugin extends QParserPlugin {

    @Override
    public QParser createParser(String string, SolrParams sp, SolrParams sp1, 
SolrQueryRequest sqr) {
        return new TestParser(string, sp1, sp1, sqr);
    }

    @Override
    public void init(NamedList nl) {
        
    }
 
    public class TestParser extends QParser{

        public TestParser(String qstr, SolrParams localParams, SolrParams 
params, SolrQueryRequest req) {
            super(qstr, localParams, params, req);
        }

        
        
        @Override
        public org.apache.lucene.search.Query parse() throws 
org.apache.lucene.queryparser.classic.ParseException {
            try {
                return JoinUtil.createJoinQuery("pageId", true, "fileId", new 
Query() {

                    @Override
                    public String toString(String string) {
                       return "pageTxtt:test";
                    }
                }, null, ScoreMode.Avg);
            } catch (IOException ex) {
                
Logger.getLogger(TestParserPlugin.class.getName()).log(Level.SEVERE, null, ex);
            }
            return null;
        }
    }
}
                  
> Add scoring support for query time join
> ---------------------------------------
>
>                 Key: LUCENE-4043
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4043
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/join
>            Reporter: Martijn van Groningen
>             Fix For: 4.0-ALPHA
>
>         Attachments: LUCENE-4043.patch, LUCENE-4043.patch, LUCENE-4043.patch, 
> LUCENE-4043.patch
>
>
> Have similar scoring for query time joining just like the index time block 
> join (with the score mode).

--
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