jekyll-meilisearch 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a72d0c48b806db86d5f211b3159947de63c62251159cb106e51bb511479af94
4
- data.tar.gz: 22c93c7ccebd787cfbd368fa5f153e07557d598262ed57190be71a4ef66d0257
3
+ metadata.gz: '09cff948b7ec1b219157c7c66c47592cfb3696fe4c338bb2b107878bfeda315f'
4
+ data.tar.gz: a706dd8eff495d9225006a5c0f6c73ccb5210580a2b2898228a4614acfd2863c
5
5
  SHA512:
6
- metadata.gz: e2095243088ae1c036775dc5b4f4c667000645f72d81f967fbefabd078f2639cdf1dbcf10cd20f03870db864219d450456e59bcf2bcfc1b812a15b0722ce56e1
7
- data.tar.gz: be0979f777189fec3ad95da485a91eac4ae946698a95c0109b895b3ebceb8ea3264fc69f0bcee1647e4d144c54edd532f23dd1cb27030e3132455447dd81f5ba
6
+ metadata.gz: 14d0e8a496a93775fde2f7d913e54afee9db82c50ab8795615473969ddd1bb5c85e411918854dbd1ce9fc5709abcab48b44c1b14866b8f2b5edb526d655ba161
7
+ data.tar.gz: b90285171c4d20d388b86dedb0a4254ebb19f9a572d3c8d7d3edc7d7ee4209c2ee3f7724bcc6cb36b60e107db12c51b2fedbe436a0bf3941014763a6a05c1397
@@ -36,22 +36,30 @@ module JekyllMeilisearch
36
36
 
37
37
  # Determine if indexing should occur based on changed files
38
38
  def should_index?
39
- # If not in incremental mode or first build, always index
39
+ # Always index if not in incremental mode (full build)
40
40
  return true unless @site.incremental?
41
41
 
42
42
  # Get the collections to monitor from config
43
43
  collections_config = config["collections"] || { "posts" => { "fields" => %w(title content url date) } }
44
44
  monitored_collections = collections_config.keys
45
45
 
46
- # Check if any changed files belong to the monitored collections
47
- changed_files = @site.regenerator.modified_files
48
- return false if changed_files.empty?
49
-
50
- changed_files.any? do |file|
51
- # Extract the relative path and check if it matches a collection
52
- relative_path = file.relative_path.sub(%r!^/!, "")
53
- collection_name = relative_path.split("/").first
54
- monitored_collections.include?(collection_name)
46
+ # Check if regenerator supports modified_files (Jekyll version compatibility)
47
+ if @site.regenerator.respond_to?(:modified_files)
48
+ changed_files = @site.regenerator.modified_files
49
+ return false if changed_files.empty?
50
+
51
+ changed_files.any? do |file|
52
+ relative_path = file.relative_path.sub(%r!^/!, "")
53
+ collection_name = relative_path.split("/").first
54
+ is_in_collection = @site.collections.key?(collection_name) && monitored_collections.include?(collection_name)
55
+ Jekyll.logger.info "Jekyll Meilisearch:",
56
+ "File: #{relative_path}, Collection: #{collection_name}, In monitored collection? #{is_in_collection}"
57
+ is_in_collection
58
+ end
59
+ else
60
+ # Fallback: Warn and assume indexing is needed if we can’t check changes
61
+ Jekyll.logger.warn "Jekyll Meilisearch:", "Incremental change detection not supported in this Jekyll version. Indexing all documents."
62
+ true
55
63
  end
56
64
  end
57
65
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Meilisearch
5
- VERSION = "0.4.6"
5
+ VERSION = "0.4.7"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-meilisearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - unicolored