groonga-client-rails 0.9.3 → 0.9.4

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: ae1aeecc659c4cf220e1053948f4a01135195918
4
- data.tar.gz: f38dc25d82bca1d26369dd69e9b2610c9f6ac3e3
3
+ metadata.gz: 61c2734632b846ae915755b89870df52681baed3
4
+ data.tar.gz: 943dda80d5cd297b3fb3256ba7d0a0d6f7a5018a
5
5
  SHA512:
6
- metadata.gz: 85b3c15830736f9430ab18f9dd4d776ff69619c82e9000ba8e6297504e32c0e427cea6b3a92ce21c8108d200815c298f3ad38bb4e69f29207a59232288434916
7
- data.tar.gz: 6840a0971efe941f3da05a46f724d86f28f39bec24d1968b87a167d8d6b69cb03e401083230e9bcc3c96d14356be186062e7a1157040af5348f293c92189a37b
6
+ metadata.gz: 2f4ee6862d905d8fcf67da653873ec3d2998eeb9236c46b3d75db3522a118b9654ebaf9537fe918b6e1e98c238e3b8ab290ceffeca7cc2dea45b8d5dfc31ce97
7
+ data.tar.gz: 22a8543082e087569e262ddb96f477e59f9605dfe48bc86a7aafb81732e453bf17e079acc92f23dba5d82f9cb12952d61f424fe4c1b25df8d78ab603379780e4
data/doc/text/news.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.9.4 - 2016-06-09
4
+
5
+ ### Improvements
6
+
7
+ * Supported vector column.
8
+
3
9
  ## 0.9.3 - 2016-06-07
4
10
 
5
11
  ### Improvements
@@ -17,7 +17,7 @@
17
17
  module Groonga
18
18
  class Client
19
19
  module Rails
20
- VERSION = "0.9.3"
20
+ VERSION = "0.9.4"
21
21
  end
22
22
  end
23
23
  end
@@ -60,6 +60,10 @@ module Groonga
60
60
  @options[:type] || "Text"
61
61
  end
62
62
 
63
+ def vector?
64
+ @options[:vector]
65
+ end
66
+
63
67
  def have_index?
64
68
  @options[:index]
65
69
  end
@@ -50,9 +50,16 @@ module Groonga
50
50
  def sync_column(column, current_column)
51
51
  if current_column.nil?
52
52
  Client.open do |client|
53
+ flags = []
54
+ if column.vector?
55
+ flags << "COLUMN_VECTOR"
56
+ else
57
+ flags << "COLUMN_SCALAR"
58
+ end
53
59
  client.column_create(:table => @schema.table,
54
60
  :name => column.name,
55
- :type => column.type)
61
+ :type => column.type,
62
+ :flags => flags.join("|"))
56
63
  end
57
64
  end
58
65
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../../
3
3
  specs:
4
- groonga-client-rails (0.9.3)
4
+ groonga-client-rails (0.9.4)
5
5
  groonga-client (>= 0.2.4)
6
6
  rails
7
7
 
@@ -15,10 +15,12 @@ class PostsController < ApplicationController
15
15
  # GET /posts/new
16
16
  def new
17
17
  @post = Post.new
18
+ @tags = tags
18
19
  end
19
20
 
20
21
  # GET /posts/1/edit
21
22
  def edit
23
+ @tags = tags
22
24
  end
23
25
 
24
26
  # POST /posts
@@ -69,6 +71,10 @@ class PostsController < ApplicationController
69
71
 
70
72
  # Never trust parameters from the scary internet, only allow the white list through.
71
73
  def post_params
72
- params.require(:post).permit(:title, :body)
74
+ params.require(:post).permit(:title, :body, tags: [])
75
+ end
76
+
77
+ def tags
78
+ ["tag1", "tag2", "tag3"]
73
79
  end
74
80
  end
@@ -3,10 +3,16 @@ class Post
3
3
  include Mongoid::Timestamps
4
4
  field :title, type: String
5
5
  field :body, type: String
6
+ field :tags, type: Array
6
7
 
7
8
  PostsSearcher.source(self).title = :title
8
9
  PostsSearcher.source(self).body = lambda do |model|
9
10
  model.body.gsub(/<.*?>/, "")
10
11
  end
12
+ PostsSearcher.source(self).tags = true
11
13
  PostsSearcher.source(self).updated_at = true
14
+
15
+ def tags=(value)
16
+ super(value.reject(&:blank?))
17
+ end
12
18
  end
@@ -9,6 +9,11 @@ class PostsSearcher < ApplicationSearcher
9
9
  index: true,
10
10
  index_type: :full_text_search,
11
11
  }
12
+ schema.column :tags, {
13
+ type: "ShortText",
14
+ vector: true,
15
+ index: true,
16
+ }
12
17
  schema.column :updated_at, {
13
18
  type: "Time",
14
19
  index: true,
@@ -19,6 +19,10 @@
19
19
  <%= f.label :body %><br>
20
20
  <%= f.text_area :body %>
21
21
  </div>
22
+ <div class="field">
23
+ <%= f.label :tags %><br>
24
+ <%= f.collection_check_boxes :tags, @tags, :to_s, :to_s %>
25
+ </div>
22
26
  <div class="actions">
23
27
  <%= f.submit %>
24
28
  </div>
@@ -1,4 +1,4 @@
1
1
  json.array!(@posts) do |post|
2
- json.extract! post, :id, :title, :body
2
+ json.extract! post, :id, :title, :body, :tags
3
3
  json.url post_url(post, format: :json)
4
4
  end
@@ -10,5 +10,11 @@
10
10
  <%= @post.body %>
11
11
  </p>
12
12
 
13
+ <p>
14
+ <strong>Tags:</strong>
15
+ <%= @post.tags.inspect %>
16
+ <%= (@post.tags || []).join(", ") %>
17
+ </p>
18
+
13
19
  <%= link_to 'Edit', edit_post_path(@post) %> |
14
20
  <%= link_to 'Back', posts_path %>
@@ -1 +1 @@
1
- json.extract! @post, :id, :title, :body, :created_at, :updated_at
1
+ json.extract! @post, :id, :title, :body, :tags, :created_at, :updated_at