redcar 0.9.1 → 0.9.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.
Files changed (63) hide show
  1. data/CHANGES +6 -0
  2. data/Rakefile +1 -1
  3. data/lib/redcar.rb +2 -2
  4. data/lib/redcar/installer.rb +3 -2
  5. metadata +4 -62
  6. data/plugins/project_search/vendor/lucene/CHANGELOG +0 -147
  7. data/plugins/project_search/vendor/lucene/CONTRIBUTORS +0 -17
  8. data/plugins/project_search/vendor/lucene/Gemfile +0 -9
  9. data/plugins/project_search/vendor/lucene/Gemfile.lock +0 -33
  10. data/plugins/project_search/vendor/lucene/LICENSE +0 -19
  11. data/plugins/project_search/vendor/lucene/README.rdoc +0 -283
  12. data/plugins/project_search/vendor/lucene/Rakefile +0 -35
  13. data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +0 -25
  14. data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +0 -26
  15. data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +0 -4
  16. data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +0 -29
  17. data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +0 -4376
  18. data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +0 -153
  19. data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +0 -18
  20. data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +0 -26
  21. data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +0 -21
  22. data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +0 -9
  23. data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +0 -7
  24. data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +0 -5
  25. data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +0 -121
  26. data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +0 -30
  27. data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +0 -50
  28. data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +0 -19
  29. data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +0 -66
  30. data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +0 -23
  31. data/plugins/project_search/vendor/lucene/examples/imdb/README +0 -12
  32. data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +0 -56
  33. data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +0 -12
  34. data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +0 -37
  35. data/plugins/project_search/vendor/lucene/examples/railway/README +0 -111
  36. data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +0 -31
  37. data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +0 -42
  38. data/plugins/project_search/vendor/lucene/examples/rest/example.rb +0 -41
  39. data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +0 -60
  40. data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +0 -34
  41. data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +0 -34
  42. data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +0 -50
  43. data/plugins/project_search/vendor/lucene/lib/lucene.rb +0 -15
  44. data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +0 -145
  45. data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +0 -96
  46. data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +0 -144
  47. data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +0 -54
  48. data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +0 -267
  49. data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +0 -146
  50. data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +0 -157
  51. data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +0 -5
  52. data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +0 -135
  53. data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +0 -117
  54. data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +0 -3
  55. data/plugins/project_search/vendor/lucene/lucene.gemspec +0 -23
  56. data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +0 -32
  57. data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +0 -70
  58. data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +0 -76
  59. data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +0 -643
  60. data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +0 -142
  61. data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +0 -101
  62. data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +0 -10
  63. data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +0 -118
@@ -1,157 +0,0 @@
1
- module Lucene
2
-
3
- class Asc
4
- class << self
5
-
6
- # Specifies which fields should be sorted in ascending order
7
- #
8
- # ==== Parameters
9
- # fields:: One or more fields to sort in ascending order (Array)
10
- #
11
- # ==== Examples
12
- # Asc[:name, :age]
13
- #
14
- # ==== Returns
15
- # An array of sort fields
16
- #
17
- def [](*fields)
18
- fields.map{|x| org.apache.lucene.search.SortField.new(x.to_s)}
19
- end
20
- end
21
- end
22
-
23
- class Desc
24
- class << self
25
- # Specifies which fields should be sorted in descending order
26
- #
27
- # ==== Block parameters
28
- # fields:: One or more fields to sort in descending order (Array)
29
- #
30
- # ==== Examples
31
- # Desc[:name, :age]
32
- #
33
- # ==== Returns
34
- # An array of sort fields
35
- #
36
- def [](*fields)
37
- fields.map{|x| org.apache.lucene.search.SortField.new(x.to_s, true)}
38
- #org.apache.lucene.search.Sort.new(values.map{|x| org.apache.lucene.search.SortField.new(x.to_s, true)}.to_java(:'org.apache.lucene.search.SortField'))
39
- end
40
- end
41
- end
42
-
43
- #
44
- # Does reuse Lucene Index Search for the same index.
45
- # Reloads the index if the index has changed.
46
- #
47
- class IndexSearcher
48
-
49
- @@paths = {}
50
-
51
- def initialize(path)
52
- @path = path
53
- end
54
-
55
- #
56
- # Only create a new object if it does not already exist for this path
57
- #
58
- def self.new(path)
59
- @@paths[path] = super(path) if @@paths[path].nil?
60
- @@paths[path]
61
- end
62
-
63
- def find_dsl(field_infos,&block)
64
- exp = QueryDSL.parse(&block)
65
- query = exp.to_lucene(field_infos)
66
-
67
- Hits.new(field_infos, index_searcher.search(query))
68
- end
69
-
70
-
71
- def find(field_info, query)
72
- # are there any index for this node ?
73
- # if not return an empty array
74
- return [] unless exist?
75
-
76
- #puts "QUERY #{query.inspect}" # '#{query.first.class.to_s}' value #{query.first}"
77
- sort_by ||= query[1].delete(:sort_by) if query[1].kind_of?(Hash)
78
- sort_by ||= query.delete(:sort_by)
79
- #puts "QUERY sort #{sort_by}"
80
- # TODO Refactoring ! too long and complex method
81
- lucene_query = case query
82
- when Array
83
- sort_by ||= query.last.delete(:sort_by) if query.last.kind_of?(Hash)
84
- parser = org.apache.lucene.queryParser.QueryParser.new(field_info.id_field.to_s, field_info.analyzer)
85
- parser.parse(query.first)
86
- when Hash
87
- bquery = org.apache.lucene.search.BooleanQuery.new
88
- query.each_pair do |key,value|
89
- field = field_info[key]
90
- q = field.convert_to_query(key, value)
91
- bquery.add(q, org.apache.lucene.search.BooleanClause::Occur::MUST)
92
- end
93
- bquery
94
- else
95
- raise StandardError.new("Unknown type #{query.class.to_s} for find #{query}")
96
- end
97
-
98
- if sort_by.nil?
99
- Hits.new(field_info, index_searcher.search(lucene_query))
100
- else
101
- sort = create_sort(sort_by)
102
- Hits.new(field_info, index_searcher.search(lucene_query, sort))
103
- end
104
-
105
- end
106
-
107
- def parse_field(field)
108
- case field
109
- when String,Symbol
110
- [org.apache.lucene.search.SortField.new(field.to_s)]
111
- when org.apache.lucene.search.SortField
112
- [field]
113
- when Array
114
- raise StandardError.new("Unknown sort field '#{field}'") unless field.first.kind_of?(org.apache.lucene.search.SortField)
115
- field
116
- end
117
- end
118
-
119
-
120
- def create_sort(fields)
121
- case fields
122
- when String,Symbol
123
- org.apache.lucene.search.Sort.new(fields.to_s)
124
- when org.apache.lucene.search.SortField
125
- org.apache.lucene.search.Sort.new(fields)
126
- when Array
127
- sorts = []
128
- fields.each do |field|
129
- sorts += parse_field(field)
130
- end
131
- org.apache.lucene.search.Sort.new(sorts.to_java(:'org.apache.lucene.search.SortField'))
132
- else
133
- StandardError.new("Unknown type #{fields.class.to_s}")
134
- end
135
- end
136
-
137
- #
138
- # Checks if it needs to reload the index searcher
139
- #
140
- def index_searcher
141
- if @index_reader.nil? || @index_reader.getVersion() != org.apache.lucene.index.IndexReader.getCurrentVersion(@path)
142
- @index_reader = org.apache.lucene.index.IndexReader.open(@path)
143
- @index_searcher = org.apache.lucene.search.IndexSearcher.new(@index_reader)
144
- $LUCENE_LOGGER.debug("Opened new IndexSearcher for #{to_s}")
145
- end
146
- @index_searcher
147
- end
148
-
149
- #
150
- # Returns true if the index already exists.
151
- #
152
- def exist?
153
- org.apache.lucene.index.IndexReader.index_exists(@path)
154
- end
155
-
156
- end
157
- end
@@ -1,5 +0,0 @@
1
- include Java
2
-
3
- module Lucene
4
- require 'lucene/jars/lucene-core-2.9.1.jar'
5
- end
@@ -1,135 +0,0 @@
1
- module Lucene
2
-
3
- class Expression #:nodoc:
4
- attr_accessor :left, :right, :op, :query
5
-
6
- def self.new_complete(left, op, right)
7
- expr = Expression.new
8
- expr.left = left
9
- expr.op = op
10
- expr.right = right
11
- expr
12
- end
13
-
14
- def self.new_uncomplete(left, query)
15
- expr = Expression.new
16
- expr.left = left
17
- expr.query = query
18
- expr
19
- end
20
-
21
- def ==(other)
22
- @op = :==
23
- @right = other
24
- @query
25
- end
26
-
27
- def >(other)
28
- @op = :>
29
- @right = other
30
- @query
31
- end
32
-
33
- #
34
- # Returns the fields being used in a query
35
- #
36
- def _fields(fields = [])
37
- if (@left.kind_of? Expression)
38
- @left._fields(fields)
39
- else
40
- fields << @left
41
- end
42
- if (@right.kind_of? Expression)
43
- @right._fields(fields)
44
- end
45
- fields
46
- end
47
-
48
- def to_lucene(field_infos)
49
- $LUCENE_LOGGER.debug{"QueryDSL.to_lucene '#{to_s}'"}
50
-
51
- if @left.kind_of? Lucene::Expression
52
- left_query = @left.to_lucene(field_infos)
53
- raise ArgumentError.new("Right term is not an Expression, but a '#{@right.class.to_s}'") unless @right.kind_of? Lucene::Expression
54
- right_query = @right.to_lucene(field_infos)
55
- query = org.apache.lucene.search.BooleanQuery.new
56
- clause = (@op == :&) ? org.apache.lucene.search.BooleanClause::Occur::MUST : org.apache.lucene.search.BooleanClause::Occur::SHOULD
57
- query.add(left_query, clause)
58
- query.add(right_query, clause)
59
- return query
60
- else
61
- field_info = field_infos[@left]
62
- field_info.convert_to_query(@left, @right)
63
- end
64
- end
65
-
66
- def to_s
67
- "(#@left #@op #@right)"
68
- end
69
- end
70
-
71
- class QueryDSL
72
- attr_reader :stack
73
-
74
- def initialize
75
- @stack = []
76
- #yield self
77
- end
78
-
79
- def self.find(field_infos = IndexInfo.new(:id), &expr)
80
- exp = QueryDSL.parse(&expr)
81
- exp.to_lucene(field_infos)
82
- end
83
-
84
-
85
-
86
- def self.parse(&query)
87
- query_dsl = QueryDSL.new
88
- query_dsl.instance_eval(&query)
89
- query_dsl.stack.last
90
- end
91
-
92
- def method_missing(methodname, *args)
93
- expr = Expression.new_uncomplete(methodname, self)
94
- @stack.push expr
95
- expr
96
- end
97
-
98
- def ==(other)
99
- puts "WRONG == '#{other}'"
100
- end
101
-
102
- def <=>(to)
103
- from = @stack.last.right
104
- @stack.last.right = Range.new(from, to)
105
- @stack.last
106
- end
107
-
108
-
109
- def &(other)
110
- raise ArgumentError.new("Expected at least two expression on stack, got #{@stack.size}") if @stack.size < 2
111
- right = @stack.pop
112
- left = @stack.pop
113
- expr = Expression.new_complete(left, :&, right)
114
- @stack.push expr
115
- self
116
- end
117
-
118
- def |(other)
119
- raise ArgumentError.new("Expected at least two expression on stack, got #{@stack.size}") if @stack.size < 2
120
- right = @stack.pop
121
- left = @stack.pop
122
- expr = Expression.new_complete(left, :|, right)
123
- @stack.push expr
124
- self
125
- end
126
-
127
- def to_s
128
- @stack.last.to_s
129
- end
130
-
131
- end
132
-
133
-
134
- end
135
-
@@ -1,117 +0,0 @@
1
- module Lucene
2
-
3
- class TransactionAlreadyRunningException < StandardError; end
4
- class TransactionNotRunningException < StandardError; end
5
-
6
- class Transaction
7
-
8
- def initialize
9
- raise TransactionAlreadyRunningException.new if Transaction.running?
10
- Thread.current[:lucene_transaction] = self
11
-
12
- @rollback = false
13
- @commited = false
14
- @indexes = {} # key is the path to index, value is the index instance
15
- end
16
-
17
- def to_s
18
- "Transaction [commited=#@commited, rollback=#@rollback, indexes=#{@indexes.size}, object_id=#{object_id}]"
19
- end
20
-
21
-
22
- # Commits all registered Indexes.
23
- # Stops this transaction (running? will be false)
24
- #
25
- def commit
26
- if !@rollback
27
- @indexes.each_value do |index|
28
- index.commit
29
- end
30
- end
31
- @commited = true
32
- @indexes.clear
33
- Thread.current[:lucene_transaction] = nil
34
- end
35
-
36
- def failure
37
- @rollback = true
38
- $LUCENE_LOGGER.debug{"Rollback Lucene Transaction"}
39
- end
40
-
41
- def rollback?
42
- @rollback
43
- end
44
-
45
- def rollback!
46
- @rollback = true
47
- end
48
-
49
- #
50
- # Registers an index to take part of this transaction
51
- #
52
- def register_index(key, index)
53
- @indexes[key] = index
54
- $LUCENE_LOGGER.debug{"Registered index for #{index}"}
55
- end
56
-
57
- #
58
- # Deregister the index so that it will not be part of the transaction
59
- # any longer.
60
- #
61
- def deregister_index(index)
62
- @indexes.delete index.path
63
- $LUCENE_LOGGER.debug{"Deregistered index for #{index}"}
64
- end
65
-
66
- #
67
- # Deregister all indexes, used for testing purpose.
68
- #
69
- def deregister_all_indexes
70
- @indexes.clear
71
- $LUCENE_LOGGER.debug{"Deregistered all index, #{@indexes.inspect}"}
72
- end
73
-
74
-
75
- def index?(path)
76
- @indexes[path] != nil
77
- end
78
-
79
- def index(path)
80
- @indexes[path]
81
- end
82
-
83
- #
84
- # Class methods
85
- #
86
- class << self
87
- def run
88
- tx = Transaction.new
89
- begin
90
- yield tx
91
- rescue => ex
92
- tx.failure
93
- # TODO reuse of error handling and logging
94
- $LUCENE_LOGGER.error{"Got exception #{ex}"}
95
- ex.backtrace.each {|t| $LUCENE_LOGGER.error(t)}
96
- raise
97
- ensure
98
- tx.commit unless tx.rollback?
99
- end
100
- end
101
-
102
- #
103
- # Returns the current transaction or nil
104
- #
105
- def current
106
- Thread.current[:lucene_transaction]
107
- end
108
-
109
-
110
- def running?
111
- self.current != nil
112
- end
113
- end
114
- end
115
-
116
-
117
- end
@@ -1,3 +0,0 @@
1
- module Lucene
2
- VERSION = '0.5.0.beta.1'
3
- end
@@ -1,23 +0,0 @@
1
- lib = File.expand_path('../lib/', __FILE__)
2
- $:.unshift lib unless $:.include?(lib)
3
-
4
- require 'lucene/version'
5
-
6
-
7
- Gem::Specification.new do |s|
8
- s.name = "lucene"
9
- s.version = Lucene::VERSION
10
- # s.platform = Gem::Platform::CURRENT # will probably support C Ruby via RJB also in the future
11
- s.authors = "Andreas Ronge"
12
- s.email = 'andreas.ronge@gmail.com'
13
- s.homepage = "http://github.com/andreasronge/lucene/tree"
14
- s.rubyforge_project = 'lucene'
15
- s.summary = "A lucene wrapper for JRuby"
16
- s.description = s.summary
17
- s.require_path = 'lib'
18
- s.files = Dir.glob("{bin,lib}/**/*") + %w(README.rdoc CHANGELOG CONTRIBUTORS Gemfile lucene.gemspec)
19
- s.has_rdoc = true
20
- s.extra_rdoc_files = %w( README.rdoc )
21
- s.rdoc_options = ["--quiet", "--title", "Lucene.rb", "--opname", "index.html", "--line-numbers", "--main", "README.rdoc", "--inline-source"]
22
- s.required_ruby_version = ">= 1.8.7"
23
- end