Lucene - Core
  1. Lucene - Core
  2. LUCENE-4043

Add scoring support for query time join

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: modules/join
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Have similar scoring for query time joining just like the index time block join (with the score mode).

      1. LUCENE-4043.patch
        56 kB
        Martijn van Groningen
      2. LUCENE-4043.patch
        55 kB
        Martijn van Groningen
      3. LUCENE-4043.patch
        31 kB
        Martijn van Groningen
      4. LUCENE-4043.patch
        19 kB
        Martijn van Groningen

        Issue Links

          Activity

          Martijn van Groningen created issue -
          Martijn van Groningen made changes -
          Field Original Value New Value
          Attachment LUCENE-4043.patch [ 12526010 ]
          Martijn van Groningen made changes -
          Attachment LUCENE-4043.patch [ 12528071 ]
          Martijn van Groningen made changes -
          Attachment LUCENE-4043.patch [ 12529952 ]
          Martijn van Groningen made changes -
          Attachment LUCENE-4043.patch [ 12529982 ]
          Martijn van Groningen made changes -
          Fix Version/s 4.0 [ 12314025 ]
          Martijn van Groningen made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          David vandendriessche made changes -
          Link This issue relates to SOLR-4307 [ SOLR-4307 ]
          David vandendriessche made changes -
          Comment [ Update on my code:

          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 {

                      IndexReader reader;
                      try {
                          //reader = IndexReader.open(FSDirectory.open(new File("C:\\java\\apache-solr-4.0.0\\apache-solr-4.0.0\\example\\solr\\Books\\data\\index")));

                          //IndexSearcher searcher = new IndexSearcher(reader);
                          IndexSearcher searcher=req.getSearcher(); //other way of getting searcher
                          BooleanQuery fromQuery = new BooleanQuery();
                          fromQuery.add(new TermQuery(new Term("pageTxt", "crazy")), BooleanClause.Occur.MUST);
                          fromQuery.add(new TermQuery(new Term("pageTxt", "test")), BooleanClause.Occur.SHOULD);
                          return JoinUtil.createJoinQuery("pageId", true, "fileId",fromQuery, searcher, ScoreMode.Avg);
                      } catch (IOException ex) {
                          Logger.getLogger(TestParserPlugin.class.getName()).log(Level.SEVERE, null, ex);
                      }
                      return null;
                  }
              }
          }

          I still have 2 questions concerning this code:
          IS my method to get the searcher alright?
          Is it possible to combine this qparser with edismax etc in stead of building queries using occur.must etc... ]
          David vandendriessche made changes -
          Comment [ 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.

          I also get an errormessage saying:
          "java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/lucene/search/join/ScoreMode"
          I've added the lucene libs and that solved this errormessage. Is it normal solr does not contain all lucene libraries?


          This is the code I'm using.

          See the next post for update! ]
          David vandendriessche made changes -
          Comment [ Isn't it possible to pass the fromQueryhash to the hash that the join query returns? ]
          Uwe Schindler made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Martijn van Groningen
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development