mod/search/set/abstract/wql_search.rb in card-1.93.6 vs mod/search/set/abstract/wql_search.rb in card-1.93.7

- old
+ new

@@ -6,11 +6,16 @@ # can be 0 or less to force no limit raise "OH NO.. no limit" unless query.mods[:limit] query.run end +def cache_query? + true +end + def fetch_query args={} + @query = nil unless cache_query? @query ||= {} @query[args.to_s] ||= query(args.clone) # cache query end def query args={} @@ -23,13 +28,15 @@ args end # override this to define search def wql_hash + @wql_hash = nil unless cache_query? @wql_hash ||= wql_from_content.merge filter_and_sort_wql end def wql_from_content + @wql_from_content = nil unless cache_query? @wql_from_content ||= begin query = content query = query.is_a?(Hash) ? query : parse_json_query(query) query.symbolize_keys end