mrkamel / search_cop

Search engine like fulltext query support for ActiveRecord
MIT License
825 stars 39 forks source link

Add tests for inequality with relative times #78

Open bkutil opened 7 months ago

bkutil commented 7 months ago

These tests demonstrate what seems to be an issue w/ relative DateTime and gt.

      def gt(value)
        super parse(value).last
      end

gt is overridden for DateTime - with relative timestamps, last - the end of the range will be Time.now, so comparing to it will fail.

gteq, which works, comes from a dynamic definition in Base class and calls map:

      def map(value)
        parse(value).first
      end

So perhaps the fix would be to get rid of gt override? But TBH, I don't have enough context for why it was introduced in 5810dccb2a09217637ed7a2329781d6e5d481d3d and when it possibly became an issue.