neo4j 1.0.0.beta.16 → 1.0.0.beta.17
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.
- data/CONTRIBUTORS +1 -0
- data/Gemfile +4 -0
- data/README.rdoc +4 -4
- data/lib/neo4j.rb +3 -2
- data/lib/neo4j/config.rb +2 -2
- data/lib/neo4j/database.rb +1 -7
- data/lib/neo4j/index/class_methods.rb +1 -1
- data/lib/neo4j/index/index_registry.rb +5 -5
- data/lib/neo4j/index/indexer.rb +8 -6
- data/lib/neo4j/jars/neo4j-index-1.2-1.2.M02.jar +0 -0
- data/lib/neo4j/jars/neo4j-kernel-1.2-1.2.M02.jar +0 -0
- data/lib/neo4j/jars/neo4j-lucene-index-0.2-1.2.M02.jar +0 -0
- data/lib/neo4j/version.rb +1 -1
- metadata +6 -5
- data/lib/neo4j/jars/neo4j-kernel-1.1.1.jar +0 -0
- data/lib/neo4j/jars/neo4j-lucene-index-0.1-20101002.153213-102.jar +0 -0
data/CONTRIBUTORS
CHANGED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -76,15 +76,15 @@ Example of using Neo4j with Rails 3 (ActiveModel)
|
|
76
76
|
|
77
77
|
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
|
78
78
|
|
79
|
-
validates :email, :presence => true,:format => { :with => email_regex }
|
80
|
-
validates :email, :uniqueness => true, :unless => :pending_account?
|
81
|
-
accepts_nested_attributes_for :avatar, :allow_destroy => true
|
82
|
-
|
83
79
|
property :email
|
84
80
|
index :email
|
85
81
|
|
86
82
|
has_one(:avatar).to(Avator)
|
87
83
|
|
84
|
+
validates :email, :presence => true,:format => { :with => email_regex }
|
85
|
+
validates :email, :uniqueness => true, :unless => :pending_account?
|
86
|
+
accepts_nested_attributes_for :avatar, :allow_destroy => true
|
87
|
+
|
88
88
|
...
|
89
89
|
end
|
90
90
|
|
data/lib/neo4j.rb
CHANGED
@@ -5,10 +5,11 @@ require 'forwardable'
|
|
5
5
|
require 'time'
|
6
6
|
require 'date'
|
7
7
|
|
8
|
-
require 'neo4j/jars/neo4j-
|
8
|
+
require 'neo4j/jars/neo4j-index-1.2-1.2.M02.jar'
|
9
|
+
require 'neo4j/jars/neo4j-kernel-1.2-1.2.M02.jar'
|
10
|
+
require 'neo4j/jars/neo4j-lucene-index-0.2-1.2.M02.jar'
|
9
11
|
require 'neo4j/jars/geronimo-jta_1.1_spec-1.1.1.jar'
|
10
12
|
require 'neo4j/jars/lucene-core-3.0.1.jar'
|
11
|
-
require 'neo4j/jars/neo4j-lucene-index-0.1-20101002.153213-102.jar'
|
12
13
|
require 'neo4j/to_java'
|
13
14
|
require 'neo4j/version'
|
14
15
|
require 'neo4j/equal'
|
data/lib/neo4j/config.rb
CHANGED
@@ -17,8 +17,8 @@ module Neo4j
|
|
17
17
|
@defaults ||= {
|
18
18
|
:storage_path => 'tmp/neo4j',
|
19
19
|
:lucene => {
|
20
|
-
:fulltext =>
|
21
|
-
:exact =>
|
20
|
+
:fulltext => {"provider" => "lucene", "type" => "fulltext" },
|
21
|
+
:exact => {"provider" => "lucene", "type" => "exact" }}
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
data/lib/neo4j/database.rb
CHANGED
@@ -9,7 +9,7 @@ module Neo4j
|
|
9
9
|
|
10
10
|
def start
|
11
11
|
@graph = org.neo4j.kernel.EmbeddedGraphDatabase.new(Config[:storage_path])
|
12
|
-
@lucene = org.neo4j.index.impl.lucene.LuceneIndexProvider.new
|
12
|
+
@lucene = @graph.index #org.neo4j.index.impl.lucene.LuceneIndexProvider.new
|
13
13
|
@graph.register_transaction_event_handler(@event_handler)
|
14
14
|
@running = true
|
15
15
|
@event_handler.neo4j_started(self)
|
@@ -18,12 +18,6 @@ module Neo4j
|
|
18
18
|
|
19
19
|
def shutdown
|
20
20
|
if @running
|
21
|
-
# since we might keep a reference to indexes we must clear them so
|
22
|
-
# that we can start neo4j with a fresh new lucene indexes
|
23
|
-
Neo4j::Transaction.run do
|
24
|
-
Neo4j::Index::IndexerRegistry.clear_all_indexes
|
25
|
-
end
|
26
|
-
|
27
21
|
@graph.unregister_transaction_event_handler(@event_handler)
|
28
22
|
@event_handler.neo4j_shutdown(self)
|
29
23
|
@graph.shutdown
|
@@ -18,7 +18,7 @@ module Neo4j
|
|
18
18
|
# :singleton-method: find
|
19
19
|
|
20
20
|
|
21
|
-
def_delegators :@_indexer, :index, :find, :index?, :index_type?, :
|
21
|
+
def_delegators :@_indexer, :index, :find, :index?, :index_type?, :delete_index_type, :rm_field_type, :add_index, :rm_index, :index_type_for, :index_name
|
22
22
|
|
23
23
|
|
24
24
|
# Sets which indexer should be used for the given node class.
|
@@ -3,14 +3,14 @@ module Neo4j
|
|
3
3
|
class IndexerRegistry #:nodoc:
|
4
4
|
class << self
|
5
5
|
|
6
|
-
def
|
7
|
-
@@indexers.values.each {|i| i.
|
6
|
+
def delete_all_indexes
|
7
|
+
@@indexers.values.each {|i| i.delete_index_type}
|
8
8
|
end
|
9
9
|
|
10
10
|
def create_for(this_clazz, using_other_clazz, type)
|
11
|
-
@@indexers
|
12
|
-
|
13
|
-
|
11
|
+
@@indexers ||= {}
|
12
|
+
index = Indexer.new(this_clazz, type)
|
13
|
+
index.inherit_fields_from(@@indexers[using_other_clazz.to_s])
|
14
14
|
@@indexers[this_clazz.to_s] = index
|
15
15
|
end
|
16
16
|
|
data/lib/neo4j/index/indexer.rb
CHANGED
@@ -156,12 +156,14 @@ module Neo4j
|
|
156
156
|
end
|
157
157
|
|
158
158
|
# clears the index, if no type is provided clear all types of indexes
|
159
|
-
def
|
159
|
+
def delete_index_type(type=nil)
|
160
160
|
if type
|
161
161
|
#raise "can't clear index of type '#{type}' since it does not exist ([#{@field_types.values.join(',')}] exists)" unless index_type?(type)
|
162
|
-
@indexes[type] && @indexes[type].
|
162
|
+
@indexes[type] && @indexes[type].delete
|
163
|
+
@indexes[type] = nil
|
163
164
|
else
|
164
|
-
@indexes.each_value { |index| index.
|
165
|
+
@indexes.each_value { |index| index.delete }
|
166
|
+
@indexes.clear
|
165
167
|
end
|
166
168
|
end
|
167
169
|
|
@@ -171,7 +173,7 @@ module Neo4j
|
|
171
173
|
@indexes.clear
|
172
174
|
end
|
173
175
|
|
174
|
-
def
|
176
|
+
def rm_field_type(type=nil)
|
175
177
|
if type
|
176
178
|
@field_types.delete_if { |k, v| v == type }
|
177
179
|
else
|
@@ -198,9 +200,9 @@ module Neo4j
|
|
198
200
|
db=Neo4j.started_db
|
199
201
|
index_config = lucene_config(type)
|
200
202
|
if @type == :node
|
201
|
-
db.lucene.
|
203
|
+
db.lucene.for_nodes("#{@indexer_for}-#{type}", index_config)
|
202
204
|
else
|
203
|
-
db.lucene.
|
205
|
+
db.lucene.for_relationships("#{@indexer_for}-#{type}", index_config)
|
204
206
|
end
|
205
207
|
end
|
206
208
|
|
Binary file
|
Binary file
|
Binary file
|
data/lib/neo4j/version.rb
CHANGED
metadata
CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
|
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- beta
|
10
|
-
-
|
11
|
-
version: 1.0.0.beta.
|
10
|
+
- 17
|
11
|
+
version: 1.0.0.beta.17
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Andreas Ronge
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-11-02 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -86,8 +86,9 @@ files:
|
|
86
86
|
- lib/neo4j/rails/validations/uniqueness.rb
|
87
87
|
- lib/neo4j/jars/lucene-core-3.0.1.jar
|
88
88
|
- lib/neo4j/jars/geronimo-jta_1.1_spec-1.1.1.jar
|
89
|
-
- lib/neo4j/jars/neo4j-
|
90
|
-
- lib/neo4j/jars/neo4j-
|
89
|
+
- lib/neo4j/jars/neo4j-lucene-index-0.2-1.2.M02.jar
|
90
|
+
- lib/neo4j/jars/neo4j-kernel-1.2-1.2.M02.jar
|
91
|
+
- lib/neo4j/jars/neo4j-index-1.2-1.2.M02.jar
|
91
92
|
- lib/neo4j/mapping/decl_relationship_dsl.rb
|
92
93
|
- lib/neo4j/mapping/node_mixin.rb
|
93
94
|
- lib/neo4j/mapping/has_n.rb
|
Binary file
|
Binary file
|