Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivots [WIP] #968

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Pivots [WIP] #968

wants to merge 1 commit into from

Conversation

jasper-lyons
Copy link

@jasper-lyons jasper-lyons commented Feb 24, 2020

Here is an initial implementation of allowing users to add pivots to their queries via the sunpot search api.

Some major additions so far

  • Pivot api added to searches. This allows queries like:
    Model.search do
        facet :created_at,
            tag: :per_month,
            range: from..to,
            range_interval: '+1MONTH',
            minimum_count: -1
    
        pivot :owned_by_location,
            range: :per_month,
            minimum_count: -1
    end
  • Adapted the range facet to support date ranges. This is required to support pivoting over date ranges. See here

I am currently lacking:

  • tests
  • documentation
  • full implementation

Others could help by:

  • reviewing the code and suggesting changes
  • adding or suggesting tests
  • documenting methods
  • updating existing documentation or making suggestions as to how docs can could change
  • Identifying other aspects of pivots that should be implemented.

* Includes API for adding a pivot to a query
* Updates RangeFacet to support date ranges (similarly to
date_field_facet)
@jasper-lyons jasper-lyons mentioned this pull request Feb 24, 2020
module Search
class PivotFacet
class Row
def initialize(fields, pivot, setup)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe fields should be in last because you are expecting more than 1 values.
def initialize(pivot, setup, fields).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @anikett-rpx, thanks for the comment!

Could you give me an example of what you mean? fields should be an explicit array of field names, entered like .new([:field1, :field2, ...], ...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants