Solr
  1. Solr
  2. SOLR-6150

Add new AnalyticsQuery to support pluggable analytics.

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.9
    • Component/s: None
    • Labels:
      None

      Description

      It would be great if there was a clean simple approach to plugin custom analytics to Solr.

      This ticket introduces the AnalyticsQuery class which makes this possible.

      To add a custom analytic query you extend AnalyticsQuery and implement:

        public abstract DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, IndexSearcher searcher);
      

      This method returns a custom DelegatingCollector which handles the collection of the analytics.

      The DelegatingCollector.finish() method can be used to conveniently finish your analytics and place the output onto the response.

      The AnalyticsQuery also has a nifty constructor that allows you to pass in a MergeStrategy (see SOLR-5973). So, when you extend AnalyticsQuery you can pass in a custom MergeStrategy to handle merging of analytic output from the shards during a distributed search.

      This design is a natural extension of the PostFilter framework. So you can plugin your AnalyticsQuery with a custom QParserPlugin, for example:

      q=*:*&fq={!myanalytic param1=p1}
      

      Just like PostFilters, AnalyticsQueries can be ordered using the "cost" parameter. This allows for analytic pipe-lining, where the result of one AnalyticsQuery can be pipe-lined to another AnalyticsQuery.

      1. SOLR-6150.patch
        37 kB
        Joel Bernstein
      2. SOLR-6150.patch
        37 kB
        Joel Bernstein
      3. SOLR-6150.patch
        36 kB
        Joel Bernstein
      4. SOLR-6150.patch
        36 kB
        Joel Bernstein

        Activity

        Joel Bernstein created issue -
        Joel Bernstein made changes -
        Field Original Value New Value
        Description It would be great if there was a clean simple approach to plugin custom analytics to Solr.

        This ticket introduces the AnalyticsQuery class which makes this possible.

        To add a custom analytic query you extend AnalyticsQuery and implement:
        <code>
          public abstract DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, IndexSearcher searcher);
        </code>

        This method returns a custom DelegatingCollector which handles the collection of the analytics.

        The DelegatingCollector.finish() method can be used to conveniently finish your analytics and place the output onto the response.

        The AnalyticsQuery also has a nifty constructor that allows you to pass in a MergeStrategy (see SOLR-5973). So, when you extend AnalyticsQuery you can pass in a custom MergeStrategy to handle merging of analytic output from the shards during a distributed search.

        This design is a natural extension of the PostFilter framework. So you can plugin your AnalyticsQuery with a custom QParserPlugin, for example:
        {code}
        q=*:*&fq={!myanalytic param1=p1}
        {code}

        Just like PostFilters, AnalyticsQueries can be ordered using the "cost" parameter. This allows for analytic pipe-lining, where the result of one AnalyticsQuery can be pipe-lined to another AnalyticsQuery.


        It would be great if there was a clean simple approach to plugin custom analytics to Solr.

        This ticket introduces the AnalyticsQuery class which makes this possible.

        To add a custom analytic query you extend AnalyticsQuery and implement:
        {code}
          public abstract DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, IndexSearcher searcher);
        {code}

        This method returns a custom DelegatingCollector which handles the collection of the analytics.

        The DelegatingCollector.finish() method can be used to conveniently finish your analytics and place the output onto the response.

        The AnalyticsQuery also has a nifty constructor that allows you to pass in a MergeStrategy (see SOLR-5973). So, when you extend AnalyticsQuery you can pass in a custom MergeStrategy to handle merging of analytic output from the shards during a distributed search.

        This design is a natural extension of the PostFilter framework. So you can plugin your AnalyticsQuery with a custom QParserPlugin, for example:
        {code}
        q=*:*&fq={!myanalytic param1=p1}
        {code}

        Just like PostFilters, AnalyticsQueries can be ordered using the "cost" parameter. This allows for analytic pipe-lining, where the result of one AnalyticsQuery can be pipe-lined to another AnalyticsQuery.


        Joel Bernstein made changes -
        Attachment SOLR-6150.patch [ 12648876 ]
        Joel Bernstein made changes -
        Attachment SOLR-6150.patch [ 12648884 ]
        Joel Bernstein made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Joel Bernstein made changes -
        Description It would be great if there was a clean simple approach to plugin custom analytics to Solr.

        This ticket introduces the AnalyticsQuery class which makes this possible.

        To add a custom analytic query you extend AnalyticsQuery and implement:
        {code}
          public abstract DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, IndexSearcher searcher);
        {code}

        This method returns a custom DelegatingCollector which handles the collection of the analytics.

        The DelegatingCollector.finish() method can be used to conveniently finish your analytics and place the output onto the response.

        The AnalyticsQuery also has a nifty constructor that allows you to pass in a MergeStrategy (see SOLR-5973). So, when you extend AnalyticsQuery you can pass in a custom MergeStrategy to handle merging of analytic output from the shards during a distributed search.

        This design is a natural extension of the PostFilter framework. So you can plugin your AnalyticsQuery with a custom QParserPlugin, for example:
        {code}
        q=*:*&fq={!myanalytic param1=p1}
        {code}

        Just like PostFilters, AnalyticsQueries can be ordered using the "cost" parameter. This allows for analytic pipe-lining, where the result of one AnalyticsQuery can be pipe-lined to another AnalyticsQuery.


        It would be great if there was a clean simple approach to plugin custom analytics to Solr.

        This ticket introduces the AnalyticsQuery class which makes this possible.

        To add a custom analytic query you extend AnalyticsQuery and implement:
        {code}
          public abstract DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, IndexSearcher searcher);
        {code}

        This method returns a custom DelegatingCollector which handles the collection of the analytics.

        The DelegatingCollector.finish() method can be used to conveniently finish your analytics and place the output onto the response.

        The AnalyticsQuery also has a nifty constructor that allows you to pass in a MergeStrategy (see SOLR-5973). So, when you extend AnalyticsQuery you can pass in a custom MergeStrategy to handle merging of analytic output from the shards during a distributed search.

        This design is a natural extension of the PostFilter framework. So you can plugin your AnalyticsQuery with a custom QParserPlugin, for example:
        {code}
        q=*:*&fq={!myanalytic param1=p1}
        {code}

        Just like PostFilters, AnalyticsQueries can be ordered using the "cost" parameter. This allows for analytic pipe-lining, where the result of one AnalyticsQuery can be pipe-lined to another AnalyticsQuery.



        Joel Bernstein made changes -
        Fix Version/s 4.9 [ 12326731 ]
        Hide
        Joel Bernstein added a comment -

        Added a couple more tests.

        Show
        Joel Bernstein added a comment - Added a couple more tests.
        Joel Bernstein made changes -
        Attachment SOLR-6150.patch [ 12649286 ]
        Hide
        Joel Bernstein added a comment -

        Fixed NPE during autowarming.

        Show
        Joel Bernstein added a comment - Fixed NPE during autowarming.
        Joel Bernstein made changes -
        Attachment SOLR-6150.patch [ 12649579 ]
        Hide
        ASF subversion and git services added a comment -

        Commit 1601664 from Joel Bernstein in branch 'dev/trunk'
        [ https://svn.apache.org/r1601664 ]

        SOLR-6150: Add new AnalyticsQuery to support pluggable analytics

        Show
        ASF subversion and git services added a comment - Commit 1601664 from Joel Bernstein in branch 'dev/trunk' [ https://svn.apache.org/r1601664 ] SOLR-6150 : Add new AnalyticsQuery to support pluggable analytics
        Hide
        ASF subversion and git services added a comment -

        Commit 1601681 from Joel Bernstein in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1601681 ]

        SOLR-6150: Add new AnalyticsQuery to support pluggable analytics

        Show
        ASF subversion and git services added a comment - Commit 1601681 from Joel Bernstein in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1601681 ] SOLR-6150 : Add new AnalyticsQuery to support pluggable analytics
        Joel Bernstein made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        ASF subversion and git services added a comment -

        Commit 1601997 from Joel Bernstein in branch 'dev/trunk'
        [ https://svn.apache.org/r1601997 ]

        SOLR-6150: Improving AnalyticsMergeStrategyTest

        Show
        ASF subversion and git services added a comment - Commit 1601997 from Joel Bernstein in branch 'dev/trunk' [ https://svn.apache.org/r1601997 ] SOLR-6150 : Improving AnalyticsMergeStrategyTest
        Hide
        ASF subversion and git services added a comment -

        Commit 1602001 from Joel Bernstein in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1602001 ]

        SOLR-6150: Improving AnalyticsMergeStrategyTest

        Show
        ASF subversion and git services added a comment - Commit 1602001 from Joel Bernstein in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1602001 ] SOLR-6150 : Improving AnalyticsMergeStrategyTest
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        8h 30m 1 Joel Bernstein 09/Jun/14 02:59
        In Progress In Progress Resolved Resolved
        1d 15h 4m 1 Joel Bernstein 10/Jun/14 18:04

          People

          • Assignee:
            Joel Bernstein
            Reporter:
            Joel Bernstein
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development