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

Make using_time_based_indices automatic at the class level #58

Open
6 tasks
esmarkowski opened this issue Mar 11, 2024 · 0 comments
Open
6 tasks

Make using_time_based_indices automatic at the class level #58

esmarkowski opened this issue Mar 11, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@esmarkowski
Copy link
Member

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
@esmarkowski esmarkowski added the enhancement New feature or request label Mar 11, 2024
@esmarkowski esmarkowski added this to the v0.6.0 milestone Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant