Skip to content

Make using_time_based_indices automatic at the class level #58

Description

@esmarkowski

Time based indices are typically on a per model basis. If we detect a query that uses key specified in use_time_based_indices then we should automatically add the indexes to search_options.

.without_time_based_indices! should turn off this behavior on a per query basis.

  • Add use_time_based_indices class method
  • Allow the index pattern to be specified and set index_name
  • using: a Proc or method to determine the required indices
  • context: specify context to trigger time_based_indices
  • default: default index name (can be most recent index or index_name*, etc)
  • QueryBuilder should detect queries that require time-based indices and populate search_options
class Post < Stretchy::Record
   use_time_based_indices :created_at, 
      pattern: "posts_%Y_%m",
      default: "posts_*",
      context: [:query, :filter],
      using: :time_based_indices
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions