jekyll-client-search 0.3.5 → 0.5.0

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.
@@ -62,12 +62,27 @@ module Jekyll
62
62
  @values.fetch("max_items")
63
63
  end
64
64
 
65
+ # Ollama model used for related-article similarity analysis. nil means
66
+ # the site uses the general embedding.model.
67
+ def index_model
68
+ value = @values["index_model"]
69
+ value&.to_s
70
+ end
71
+
65
72
  private
66
73
 
67
74
  def validate!
68
75
  validate_booleans!
69
76
  validate_similarity!
70
77
  validate_max_items!
78
+ validate_index_model!
79
+ end
80
+
81
+ def validate_index_model!
82
+ return if index_model.nil? || !index_model.empty?
83
+
84
+ raise Jekyll::Errors::FatalException,
85
+ "client_search related index_model must not be empty"
71
86
  end
72
87
 
73
88
  def validate_booleans!
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module ClientSearch
5
+ # Validates semantic-engine index settings: which Ollama model's vectors
6
+ # are written into the search index and must match the browser query
7
+ # embedder's vector space.
8
+ class SemanticConfiguration
9
+ def initialize(config)
10
+ unless config.is_a?(Hash)
11
+ raise Jekyll::Errors::FatalException,
12
+ "client_search semantic configuration must be a mapping"
13
+ end
14
+
15
+ @values = config
16
+ validate!
17
+ end
18
+
19
+ # Ollama model embedded into the search index. nil means the site uses
20
+ # the general embedding.model.
21
+ def index_model
22
+ value = @values["index_model"]
23
+ value&.to_s
24
+ end
25
+
26
+ def document_prefix
27
+ value = @values["document_prefix"]
28
+ value&.to_s
29
+ end
30
+
31
+ def query_prefix
32
+ value = @values["query_prefix"]
33
+ value&.to_s
34
+ end
35
+
36
+ private
37
+
38
+ def validate!
39
+ return if index_model.nil? || !index_model.empty?
40
+
41
+ raise Jekyll::Errors::FatalException,
42
+ "client_search semantic index_model must not be empty"
43
+ end
44
+ end
45
+ end
46
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module ClientSearch
5
- VERSION = "0.3.5"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
@@ -9,6 +9,7 @@ require_relative "client_search/version"
9
9
  require_relative "client_search/embedding_configuration"
10
10
  require_relative "client_search/live_search_configuration"
11
11
  require_relative "client_search/related_configuration"
12
+ require_relative "client_search/semantic_configuration"
12
13
  require_relative "client_search/dropdown_configuration"
13
14
  require_relative "client_search/query_embedder_configuration"
14
15
  require_relative "client_search/configuration_accessors"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-client-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svend Gundestrup
@@ -78,6 +78,7 @@ files:
78
78
  - lib/jekyll/client_search/script_tags.rb
79
79
  - lib/jekyll/client_search/search_index_page.rb
80
80
  - lib/jekyll/client_search/search_tag.rb
81
+ - lib/jekyll/client_search/semantic_configuration.rb
81
82
  - lib/jekyll/client_search/tasks.rb
82
83
  - lib/jekyll/client_search/version.rb
83
84
  homepage: https://github.com/gundestrup/jekyll-client-search