jekyll_search 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 0272796b99e85011ccd3b24088e8d5af7ca1bda1
4
- data.tar.gz: 7de7bfb19915e80aa22c8010b30a9c68acfae2a3
3
+ metadata.gz: 266d467d948e0f06e9b67d80b4460e39127e57e1
4
+ data.tar.gz: 42098ce4e4628cf9a2ac55ea3dad5fe5f0871f11
5
5
  SHA512:
6
- metadata.gz: e63c744a1a09fbe448b8cd5be7a07cbf86b50343d90ef89ae28b5c08038fc7704a3d8c44df995dd4d9a1d0a6d447ce3c66df073ff546c74c58f38280b60d86ea
7
- data.tar.gz: 17ba283c261386c92ead77570830f6ca8d44540f48dc801a0b19e004967b7ed09b3ec3bba7b1797e1e9d2eb84ece7be4a9813ce70988ff1604144e48438e4a66
6
+ metadata.gz: 7a74dead448ac960a3c32e6546b181fe7561d9c1a57ca6ddcdbca4104378f7dae2d2ef0fe7ff2482adb11d77b0b72709d57bf8a0947c2cce69777931780f8f55
7
+ data.tar.gz: 4a08fdc4d9474469f2e0a8f1c4cb1c30146ae8bf83dc499498b9bfd4b7e944e4607d1672c08a640880903fc7a1712a8b13517b87e958b25801f1876026cc8369
data/README.md CHANGED
@@ -37,31 +37,35 @@ the following entries into your Jekyll `_config.yml` (replace the `host` entry i
37
37
  # Search index settings
38
38
  search:
39
39
  host: localhost:9200
40
+ index:
41
+ name: myindex
40
42
  ```
41
43
 
42
44
  Now run `jekyll index` to iterate over all pages and index them with Elasticsearch. With `jekyll search my query`
43
45
  you can throw some test searches against your freshly created search index.
44
46
 
45
- If you want to customize how Elasticsearch creates the search index, then provide an additional `index` property
46
- in your `_config.yml` (see [here][elasticsearch-createindex]:
47
+ If you want to customize how Elasticsearch creates the search index, then provide an additional `index.settings`
48
+ property in your `_config.yml` (see [here][elasticsearch-createindex]:
47
49
 
48
50
  ```yaml
49
51
  # Search index settings
50
52
  search:
51
53
  host: localhost:9200
52
54
  index:
53
- mappings:
54
- page:
55
- properties:
56
- url:
57
- type: string
58
- analyzer: keyword
59
- title:
60
- type: string
61
- analyzer: english
62
- content:
63
- type: string
64
- analyzer: english
55
+ name: myindex
56
+ settings:
57
+ mappings:
58
+ page:
59
+ properties:
60
+ url:
61
+ type: string
62
+ analyzer: keyword
63
+ title:
64
+ type: string
65
+ analyzer: english
66
+ content:
67
+ type: string
68
+ analyzer: english
65
69
  ```
66
70
 
67
71
  ## Contributing
data/lib/jekyll_search.rb CHANGED
@@ -41,7 +41,7 @@ module Jekyll
41
41
  content: clean_content(page.content)
42
42
  }
43
43
 
44
- client.index index: 'documentation', type: 'page', body: body
44
+ client.index index: settings['index']['name'], type: 'page', body: body
45
45
  end
46
46
  end
47
47
 
@@ -61,11 +61,11 @@ module Jekyll
61
61
  end
62
62
 
63
63
  def create_index(client, settings)
64
- if client.indices.exists index: 'documentation'
65
- client.indices.delete index: 'documentation'
64
+ if client.indices.exists index: settings['index']['name']
65
+ client.indices.delete index: settings['index']['name']
66
66
  end
67
67
 
68
- client.indices.create index: 'documentation', body: (settings['index'] or {})
68
+ client.indices.create index: settings['index']['name'], body: (settings['index']['settings'] or {})
69
69
  end
70
70
  end
71
71
  end
@@ -91,7 +91,7 @@ module Jekyll
91
91
  settings = site.config['search']
92
92
 
93
93
  client = Elasticsearch::Client.new host: settings['host'], log: false
94
- result = client.search index: 'documentation', body: { query: { match: { content: query } }, highlight: { fields: { content: {} }} }
94
+ result = client.search index: settings['index']['name'], body: { query: { match: { content: query } }, highlight: { fields: { content: {} }} }
95
95
 
96
96
  puts "Query: #{query}"
97
97
  puts "Total: #{result['hits']['total']}"
@@ -1,3 +1,3 @@
1
1
  module JekyllSearch
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Hoffmeister