Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8208

DocTransformer executes sub-queries

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments



      The initial idea was to return "from" side of query time join via doctransformer. I suppose it isn't query-time join specific, thus let to specify any query and parameters for them, let's call it sub-query. But it might be problematic to escape subquery parameters, including local ones, e.g. what if subquery needs to specify own doctransformer in &fl=[..] ?
      I suppose we can specify subquery parameter prefix:

      ..&q=name_s:john&fl=*,depts:[subquery fromIndex=departments]&
      depts.q={!term f=dept_id_s v=$row.dept_ss_dv}&depts.fl=text_t,dept_id_s_dv&depts.rows=12&depts.sort=id desc

      response is like

          <result name="response" numFound="1" start="0">
                  <str name="id">1</str>
                  <str name="name_s_dv">john</str>
                  <result name="depts" numFound="2" start="0">
                          <str name="dept_id_s_dv">Engineering</str>
                          <str name="text_t">These guys develop stuff</str>
                          <str name="dept_id_s_dv">Support</str>
                          <str name="text_t">These guys help users</str>
      • fl=depts:[subquery] executes a separate request for every query result row, and adds it into a document as a separate result list. The given field name (here it's 'depts') is used as a prefix to shift subquery parameters from main query parameter, eg depts.q turns to q for subquery, depts.rows to rows.
      • document fields are available as implicit parameters with prefix row. eg. if result document has a field dept_id it can be referred as v=$row.dept_id this combines well with {!terms} query parser
      • separator=',' is used when multiple field values are combined in parameter. eg. a document has multivalue field

        , thus referring to it via

        ..&dept.q={!terms f=id v=$row.dept_ids}&..

        executes a subquery

        {!terms f=id}2,3

        . When omitted it's a comma.

      • fromIndex=othercore optional param allows to run subquery on other core, like it works on query time join
        However, it doesn't work on cloud setup (and will let you know), but it's proposed to use regular params (collection, shards - whatever, with subquery prefix as below ) to issue subquery to a collection
        depts.q={!terms f=dept_id_s v=$row.dept_ss_dv}&depts.fl=text_t&

      Caveat: it should be a way slow; it handles only search result page, not entire result set.


        1. SOLR-8208.diff
          24 kB
          Cao Manh Dat
        2. SOLR-8208.patch
          84 kB
          Mikhail Khludnev
        3. SOLR-8208.patch
          79 kB
          Mikhail Khludnev
        4. SOLR-8208.patch
          79 kB
          Mikhail Khludnev
        5. SOLR-8208.patch
          56 kB
          Mikhail Khludnev
        6. SOLR-8208.patch
          50 kB
          Mikhail Khludnev
        7. SOLR-8208.patch
          48 kB
          Mikhail Khludnev
        8. SOLR-8208.patch
          47 kB
          Cao Manh Dat
        9. SOLR-8208.patch
          45 kB
          Mikhail Khludnev
        10. SOLR-8208.patch
          43 kB
          Mikhail Khludnev
        11. SOLR-8208.patch
          31 kB
          Mikhail Khludnev
        12. SOLR-8208.patch
          28 kB
          Mikhail Khludnev
        13. SOLR-8208.patch
          25 kB
          Mikhail Khludnev
        14. SOLR-8208.patch
          18 kB
          Mikhail Khludnev
        15. SOLR-8208.patch
          17 kB
          Mikhail Khludnev
        16. SOLR-8208.patch
          24 kB
          Cao Manh Dat
        17. SOLR-8208.patch
          11 kB
          Mikhail Khludnev
        18. SOLR-8208.patch
          11 kB
          Cao Manh Dat
        19. SOLR-8208.patch
          10 kB
          Cao Manh Dat
        20. SOLR-8208-distrib-test-fix.patch
          1 kB
          Mikhail Khludnev

        Issue Links


          This comment will be Viewable by All Users Viewable by All Users


            mkhl Mikhail Khludnev
            mkhl Mikhail Khludnev
            0 Vote for this issue
            12 Start watching this issue




                Issue deployment