redcar 0.9.2 → 0.10
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/CHANGES +34 -4
- data/Rakefile +2 -1
- data/lib/redcar.rb +3 -3
- data/lib/redcar/installer.rb +2 -3
- data/plugins/application/features/step_definitions/dialog_steps.rb +7 -0
- data/plugins/application/features/step_definitions/key_steps.rb +18 -0
- data/plugins/application/features/step_definitions/menu_steps.rb +5 -6
- data/plugins/application/features/step_definitions/speedbar_steps.rb +29 -9
- data/plugins/application/features/step_definitions/tree_steps.rb +13 -0
- data/plugins/application/features/support/env.rb +39 -5
- data/plugins/application/features/support/fake_event.rb +12 -0
- data/plugins/application/lib/application.rb +5 -6
- data/plugins/application/lib/application/dialog.rb +53 -10
- data/plugins/application/lib/application/dialogs/modeless_list_dialog.rb +85 -0
- data/plugins/application/lib/application/keymap.rb +10 -8
- data/plugins/application/lib/application/menu.rb +38 -16
- data/plugins/application/lib/application/treebook.rb +30 -0
- data/plugins/application/lib/application/window.rb +20 -2
- data/plugins/application/spec/application/command/executor_spec.rb +1 -0
- data/plugins/application/spec/application/menu_spec.rb +26 -26
- data/plugins/application/spec/application/treebook_spec.rb +6 -6
- data/plugins/application/spec/spec_helper.rb +10 -1
- data/plugins/application_swt/lib/application_swt.rb +25 -3
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +48 -27
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +22 -11
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_dialog.rb +113 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_html_dialog.rb +85 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_list_dialog_controller.rb +143 -0
- data/plugins/application_swt/lib/application_swt/gradient.rb +61 -0
- data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -4
- data/plugins/application_swt/lib/application_swt/notebook.rb +5 -8
- data/plugins/application_swt/lib/application_swt/speedbar.rb +1 -0
- data/plugins/application_swt/lib/application_swt/treebook.rb +6 -8
- data/plugins/application_swt/lib/application_swt/window.rb +85 -57
- data/plugins/application_swt/lib/swt/graphics_utils.rb +23 -0
- data/plugins/application_swt/lib/swt/vtab_folder.rb +7 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +1 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +142 -0
- data/plugins/auto_completer/lib/auto_completer.rb +10 -42
- data/plugins/auto_completer/lib/auto_completer/list_dialog.rb +21 -0
- data/plugins/clojure/lib/clojure.rb +33 -0
- data/plugins/{repl/lib/repl/clojure_mirror.rb → clojure/lib/clojure/repl_mirror.rb} +16 -20
- data/plugins/clojure/plugin.rb +9 -0
- data/plugins/{repl/spec/repl/clojure_mirror_spec.rb → clojure/spec/clojure/repl_mirror_spec.rb} +12 -13
- data/plugins/clojure/spec/spec_helper.rb +5 -0
- data/plugins/{repl → clojure}/vendor/Wrapper.clj +0 -0
- data/plugins/{repl → clojure}/vendor/dummy +0 -0
- data/plugins/{repl → clojure}/vendor/enclojure-wrapper.jar +0 -0
- data/plugins/connection_manager/lib/connection_manager.rb +13 -13
- data/plugins/declarations/lib/declarations.rb +17 -6
- data/plugins/document_search/features/find.feature +389 -0
- data/plugins/document_search/features/find_and_replace.feature +723 -0
- data/plugins/document_search/features/replace.feature +69 -62
- data/plugins/document_search/lib/document_search.rb +81 -64
- data/plugins/document_search/lib/document_search/commands.rb +258 -0
- data/plugins/document_search/lib/document_search/find_and_replace_speedbar.rb +142 -0
- data/plugins/document_search/lib/document_search/find_speedbar.rb +102 -0
- data/plugins/document_search/lib/document_search/query_options.rb +45 -0
- data/plugins/edit_view/features/case_change.feature +9 -5
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +19 -0
- data/plugins/edit_view/lib/edit_view.rb +15 -12
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +12 -2
- data/plugins/edit_view/lib/edit_view/commands/text_conversion_commands.rb +1 -1
- data/plugins/edit_view/lib/edit_view/document.rb +129 -99
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +33 -15
- data/plugins/encryption/encryption.rb +2 -0
- data/plugins/find-in-project/lib/find_in_project.rb +3 -5
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +2 -0
- data/plugins/groovy/features/step_definitions/groovy_steps.rb +2 -2
- data/plugins/groovy/features/syntax_check_groovy.feature +3 -3
- data/plugins/groovy/lib/groovy.rb +38 -0
- data/plugins/groovy/lib/groovy/commands.rb +10 -0
- data/plugins/{repl/lib/repl/groovy_mirror.rb → groovy/lib/groovy/repl_mirror.rb} +33 -13
- data/plugins/groovy/lib/{syntax_check/groovy.rb → groovy/syntax_checker.rb} +13 -8
- data/plugins/groovy/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/groovy_mirror_spec.rb → groovy/spec/groovy/repl_mirror_spec.rb} +14 -13
- data/plugins/groovy/spec/spec_helper.rb +5 -0
- data/plugins/html_view/assets/json2.js +476 -0
- data/plugins/html_view/lib/html_view.rb +1 -0
- data/plugins/java/features/fixtures/test.java +0 -0
- data/plugins/java/features/support/env.rb +27 -0
- data/plugins/java/features/syntax_check_java.feature +86 -0
- data/plugins/java/lib/syntax_check/java.rb +86 -0
- data/plugins/java/plugin.rb +7 -0
- data/plugins/javascript/features/fixtures/test2.js +5 -0
- data/plugins/javascript/features/step_definitions/javascript_steps.rb +16 -0
- data/plugins/javascript/features/support/env.rb +14 -0
- data/plugins/javascript/features/syntax_check_javascript.feature +46 -3
- data/plugins/javascript/lib/syntax_check/javascript.rb +15 -9
- data/plugins/line_tools/features/trim_line.feature +49 -0
- data/plugins/line_tools/lib/line_tools.rb +5 -1
- data/plugins/mirah/README +7 -0
- data/plugins/mirah/features/fixtures/test.mirah +2 -0
- data/plugins/mirah/features/syntax_check_mirah.feature +46 -0
- data/plugins/mirah/lib/mirah.rb +43 -0
- data/plugins/mirah/lib/mirah/my_error_handler.rb +22 -0
- data/plugins/mirah/lib/mirah/repl_mirror.rb +50 -0
- data/plugins/mirah/lib/mirah/syntax_checker.rb +38 -0
- data/plugins/mirah/plugin.rb +8 -0
- data/plugins/mirah/spec/mirah/repl_mirror_spec.rb +188 -0
- data/plugins/mirah/spec/spec_helper.rb +5 -0
- data/plugins/mirah/vendor/mirah-parser.jar +0 -0
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +24 -23
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +10 -1
- data/plugins/plugin_manager_ui/views/index.html.erb +2 -0
- data/plugins/project/features/find_file.feature +40 -16
- data/plugins/project/features/highlight_focussed_tab.feature +16 -10
- data/plugins/project/features/step_definitions/find_file_steps.rb +11 -0
- data/plugins/project/features/step_definitions/project_tree_steps.rb +5 -1
- data/plugins/project/features/support/env.rb +5 -0
- data/plugins/project/lib/project/commands.rb +8 -1
- data/plugins/project/lib/project/dir_controller.rb +4 -1
- data/plugins/project/lib/project/find_file_dialog.rb +16 -12
- data/plugins/project/lib/project/manager.rb +30 -1
- data/plugins/project_search/vendor/lucene/CHANGELOG +147 -0
- data/plugins/project_search/vendor/lucene/CONTRIBUTORS +17 -0
- data/plugins/project_search/vendor/lucene/Gemfile +9 -0
- data/plugins/project_search/vendor/lucene/Gemfile.lock +33 -0
- data/plugins/project_search/vendor/lucene/LICENSE +19 -0
- data/plugins/project_search/vendor/lucene/README.rdoc +283 -0
- data/plugins/project_search/vendor/lucene/Rakefile +35 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +25 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +4 -0
- data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +29 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +4376 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +153 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +18 -0
- data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +21 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +9 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +7 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +5 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +121 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +30 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +50 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +19 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +66 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +23 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/README +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +56 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +37 -0
- data/plugins/project_search/vendor/lucene/examples/railway/README +111 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +31 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +42 -0
- data/plugins/project_search/vendor/lucene/examples/rest/example.rb +41 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +60 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +50 -0
- data/plugins/project_search/vendor/lucene/lib/lucene.rb +15 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +145 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +96 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +144 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +54 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +267 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +146 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +157 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +5 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +135 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +117 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +3 -0
- data/plugins/project_search/vendor/lucene/lucene.gemspec +23 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +32 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +70 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +76 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +643 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +142 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +101 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +10 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +118 -0
- data/plugins/redcar/features/alter_font_size.feature +25 -0
- data/plugins/redcar/features/step_definitions/font_steps.rb +34 -0
- data/plugins/redcar/redcar.rb +256 -43
- data/plugins/repl/features/command_editing.feature +55 -0
- data/plugins/repl/features/command_history.feature +75 -0
- data/plugins/repl/features/step_definitions/repl_steps.rb +17 -1
- data/plugins/repl/features/support/env.rb +24 -0
- data/plugins/repl/features/support/fake_repl.rb +16 -0
- data/plugins/repl/lib/repl.rb +17 -74
- data/plugins/repl/lib/repl/repl_command.rb +20 -0
- data/plugins/repl/lib/repl/repl_mirror.rb +168 -22
- data/plugins/repl/lib/repl/repl_tab.rb +131 -6
- data/plugins/repl/plugin.rb +1 -1
- data/plugins/repl/spec/repl/repl_mirror_spec.rb +72 -0
- data/plugins/repl/spec/spec_helper.rb +1 -1
- data/plugins/repl_swt/lib/repl_swt.rb +7 -0
- data/plugins/repl_swt/lib/repl_swt/key_listener.rb +43 -0
- data/plugins/repl_swt/plugin.rb +8 -0
- data/plugins/ruby/lib/ruby.rb +35 -0
- data/plugins/{repl/lib/repl/ruby_mirror.rb → ruby/lib/ruby/repl_mirror.rb} +12 -12
- data/plugins/ruby/lib/{syntax_check/ruby.rb → ruby/syntax_checker.rb} +3 -3
- data/plugins/ruby/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/ruby_mirror_spec.rb → ruby/spec/ruby/repl_mirror_spec.rb} +38 -29
- data/plugins/ruby/spec/spec_helper.rb +5 -0
- data/plugins/runnables/lib/runnables.rb +2 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +5 -0
- data/plugins/runnables/lib/runnables/output_processor.rb +14 -3
- data/plugins/runnables/views/command_output.html.erb +3 -2
- data/plugins/scm/lib/scm.rb +4 -2
- data/plugins/scm/lib/scm/diff_mirror.rb +6 -6
- data/plugins/scm_git/lib/scm_git.rb +136 -107
- data/plugins/scm_git/lib/scm_git/change.rb +28 -19
- data/plugins/snippets/lib/snippets/explorer.rb +2 -2
- data/plugins/swt/lib/swt/full_swt.rb +1 -0
- data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +4 -0
- data/plugins/syntax_check/features/support/env.rb +3 -0
- data/plugins/syntax_check/lib/syntax_check.rb +71 -5
- data/plugins/syntax_check/lib/syntax_check/annotation.rb +61 -0
- data/plugins/test_runner/lib/test_runner.rb +39 -0
- data/plugins/test_runner/lib/test_runner/rspec_runner.rb +20 -0
- data/plugins/test_runner/lib/test_runner/run_test_command.rb +63 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +26 -0
- data/plugins/test_runner/plugin.rb +8 -0
- data/plugins/test_runner/spec/run_test_command_spec.rb +51 -0
- data/plugins/test_runner/spec/spec_helper.rb +5 -0
- data/plugins/textmate/lib/textmate.rb +12 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/HTML.tmbundle/Syntaxes/HTML.plist +0 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/Syntaxes/Mirah.plist +22 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +12 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby.tmbundle/Syntaxes/Ruby.plist +2 -0
- data/plugins/todo_list/lib/todo_list.rb +7 -0
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +3 -1
- data/plugins/tree/lib/tree.rb +4 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +5 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +10 -0
- metadata +137 -22
- data/plugins/document_search/features/search.feature +0 -163
- data/plugins/document_search/lib/document_search/replace_all_command.rb +0 -27
- data/plugins/document_search/lib/document_search/replace_command.rb +0 -38
- data/plugins/document_search/lib/document_search/replace_next_command.rb +0 -27
- data/plugins/document_search/lib/document_search/search_and_replace.rb +0 -81
- data/plugins/ruby/README +0 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Maintainer:
|
|
2
|
+
Andreas Ronge <andreas dot ronge at gmail dot com>
|
|
3
|
+
|
|
4
|
+
Contributors:
|
|
5
|
+
* Martin Kleppmann
|
|
6
|
+
* Peter Neubauer
|
|
7
|
+
* Jan-Felix Wittmann
|
|
8
|
+
* Marius Mårnes Mathiesen
|
|
9
|
+
* Bert Fitié
|
|
10
|
+
* Jan Berkel
|
|
11
|
+
* David Beckwith
|
|
12
|
+
* Johny Ho
|
|
13
|
+
* Carlo Cabanilla
|
|
14
|
+
* Anders Janmyr
|
|
15
|
+
* Nick Sieger
|
|
16
|
+
* Sean Bowman
|
|
17
|
+
* BrilliantArc
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
lucene (0.5.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: http://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
diff-lcs (1.1.2)
|
|
10
|
+
horo (1.0.2)
|
|
11
|
+
rdoc (~> 2.5)
|
|
12
|
+
rake (0.8.7)
|
|
13
|
+
rdoc (2.5.11)
|
|
14
|
+
rspec (2.0.1)
|
|
15
|
+
rspec-core (~> 2.0.1)
|
|
16
|
+
rspec-expectations (~> 2.0.1)
|
|
17
|
+
rspec-mocks (~> 2.0.1)
|
|
18
|
+
rspec-core (2.0.1)
|
|
19
|
+
rspec-expectations (2.0.1)
|
|
20
|
+
diff-lcs (>= 1.1.2)
|
|
21
|
+
rspec-mocks (2.0.1)
|
|
22
|
+
rspec-core (~> 2.0.1)
|
|
23
|
+
rspec-expectations (~> 2.0.1)
|
|
24
|
+
|
|
25
|
+
PLATFORMS
|
|
26
|
+
java
|
|
27
|
+
|
|
28
|
+
DEPENDENCIES
|
|
29
|
+
horo (>= 1.0.2)
|
|
30
|
+
lucene!
|
|
31
|
+
rake (>= 0.8.7)
|
|
32
|
+
rdoc (>= 2.5.10)
|
|
33
|
+
rspec (>= 2.0.0)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2008 Andreas Ronge
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
= Lucene.rb
|
|
2
|
+
|
|
3
|
+
Lucene.rb is JRuby wrapper for the Lucene document database.
|
|
4
|
+
|
|
5
|
+
* Lucene (http://lucene.apache.org/java/docs/index.html) for querying and indexing.
|
|
6
|
+
|
|
7
|
+
== Status
|
|
8
|
+
|
|
9
|
+
This library was once included in the neo4j.rb gem (version <= 0.4.6).
|
|
10
|
+
The neo4j wrapper has now replaced this library with the included Java neo4j-lucene component. The main reason for this split was that neo4j now uses two phase commit to keep the databases in sync.
|
|
11
|
+
|
|
12
|
+
=== TODO
|
|
13
|
+
* Upgrade to newer lucene 3.x
|
|
14
|
+
* Check the thread synchronization and locking - is this needed ?
|
|
15
|
+
|
|
16
|
+
== Installation
|
|
17
|
+
|
|
18
|
+
==== Install JRuby
|
|
19
|
+
The easiest way to install JRuby is by using RVM, see http://rvm.beginrescueend.com. Otherwise check: http://kenai.com/projects/jruby/pages/GettingStarted#Installing_JRuby
|
|
20
|
+
|
|
21
|
+
== Lucene.rb
|
|
22
|
+
|
|
23
|
+
Lucene provides:
|
|
24
|
+
* Flexible Queries - Phrases, Wildcards, Compound boolean expressions etc...
|
|
25
|
+
* Field-specific Queries eg. title, artist, album
|
|
26
|
+
* Sorting
|
|
27
|
+
* Ranked Searching
|
|
28
|
+
|
|
29
|
+
The Lucene index will be updated after the transaction commits. It is not possible to
|
|
30
|
+
query for something that has been created inside the same transaction as where the query is performed.
|
|
31
|
+
|
|
32
|
+
=== Lucene Document
|
|
33
|
+
|
|
34
|
+
In Lucene everything is a Document. A document can represent anything textual:
|
|
35
|
+
A Word Document, a DVD (the textual metadata only), or a Neo4j.rb node.
|
|
36
|
+
A document is like a record or row in a relationship database.
|
|
37
|
+
|
|
38
|
+
The following example shows how a document can be created by using the ''<<'' operator
|
|
39
|
+
on the Lucene::Index class and found using the Lucene::Index#find method.
|
|
40
|
+
|
|
41
|
+
Example of how to write a document and find it:
|
|
42
|
+
|
|
43
|
+
require 'lucene'
|
|
44
|
+
|
|
45
|
+
include Lucene
|
|
46
|
+
|
|
47
|
+
# the var/myindex parameter is either a path where to store the index or
|
|
48
|
+
# just a key if index is kept in memory (see below)
|
|
49
|
+
index = Index.new('var/myindex')
|
|
50
|
+
|
|
51
|
+
# add one document (a document is like a record or row in a relationship database)
|
|
52
|
+
index << {:id=>'1', :name=>'foo'}
|
|
53
|
+
|
|
54
|
+
# write to the index file
|
|
55
|
+
index.commit
|
|
56
|
+
|
|
57
|
+
# find a document with name foo
|
|
58
|
+
# hits is a ruby Enumeration of documents
|
|
59
|
+
hits = index.find{name == 'foo'}
|
|
60
|
+
|
|
61
|
+
# show the id of the first document (document 0) found
|
|
62
|
+
# (the document contains all stored fields - see below)
|
|
63
|
+
hits[0][:id] # => '1'
|
|
64
|
+
|
|
65
|
+
Notice that you have to call the commit method in order to update the index (both disk and in memory indexes).
|
|
66
|
+
Performing several update and delete operations before a commit will give much
|
|
67
|
+
better performance than committing after each operation.
|
|
68
|
+
|
|
69
|
+
=== Keep indexing on disk
|
|
70
|
+
|
|
71
|
+
By default Neo4j::Lucene keeps indexes in memory. That means that when the application restarts
|
|
72
|
+
the index will be gone and you have to reindex everything again.
|
|
73
|
+
|
|
74
|
+
To store indexes on file:
|
|
75
|
+
|
|
76
|
+
Lucene::Config[:store_on_file] = true
|
|
77
|
+
Lucene::Config[:storage_path] => '/home/neo/lucene-db'
|
|
78
|
+
|
|
79
|
+
When creating a new index the location of the index will be the Lucene::Config[:storage_path] + index path
|
|
80
|
+
Example:
|
|
81
|
+
|
|
82
|
+
Lucene::Config[:store_on_file] = true
|
|
83
|
+
Lucene::Config[:storage_path] => '/home/neo/lucene-db'
|
|
84
|
+
index = Index.new('/foo/lucene')
|
|
85
|
+
|
|
86
|
+
The example above will store the index at /home/neo/lucene-db/foo/lucene
|
|
87
|
+
|
|
88
|
+
=== Indexing several values with the same key
|
|
89
|
+
|
|
90
|
+
Let say a person can have several phone numbers. How do we index that?
|
|
91
|
+
|
|
92
|
+
index << {:id=>'1', :name=>'adam', :phone => ['987-654', '1234-5678']}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
=== Id field
|
|
96
|
+
|
|
97
|
+
All Documents must have one id field. If an id is not specified, the default will be: :id of type String.
|
|
98
|
+
A different id can be specified using the field_infos id_field property on the index:
|
|
99
|
+
|
|
100
|
+
index = Index.new('some/path/to/the/index')
|
|
101
|
+
index.field_infos.id_field = :my_id
|
|
102
|
+
|
|
103
|
+
To change the type of the my_id from String to a different type see below.
|
|
104
|
+
|
|
105
|
+
=== Conversion of types
|
|
106
|
+
|
|
107
|
+
Lucene.rb can handle type conversion for you. (The Java Lucene library stores all
|
|
108
|
+
the fields as Strings)
|
|
109
|
+
For example if you want the id field to be a Fixnum
|
|
110
|
+
|
|
111
|
+
require 'lucene'
|
|
112
|
+
include Lucene
|
|
113
|
+
|
|
114
|
+
index = Index.new('var/myindex') # store the index at dir: var/myindex
|
|
115
|
+
index.field_infos[:id][:type] = Fixnum
|
|
116
|
+
|
|
117
|
+
index << {:id=>1, :name=>'foo'} # notice 1 is not a string now
|
|
118
|
+
|
|
119
|
+
index.commit
|
|
120
|
+
|
|
121
|
+
# find that document, hits is a ruby Enumeration of documents
|
|
122
|
+
hits = index.find(:name => 'foo')
|
|
123
|
+
|
|
124
|
+
# show the id of the first document (document 0) found
|
|
125
|
+
# (the document contains all stored fields - see below)
|
|
126
|
+
doc[0][:id] # => 1
|
|
127
|
+
|
|
128
|
+
If the field_info type parameter is not set then it has a default value of String.
|
|
129
|
+
|
|
130
|
+
=== Storage of fields
|
|
131
|
+
|
|
132
|
+
By default only the id field will be stored.
|
|
133
|
+
That means that in the example above the :name field will not be included in the document.
|
|
134
|
+
|
|
135
|
+
Example
|
|
136
|
+
doc = index.find('name' => 'foo')
|
|
137
|
+
doc[:id] # => 1
|
|
138
|
+
doc[:name] # => nil
|
|
139
|
+
|
|
140
|
+
Use the field info :store=true if you want a field to be stored in the index
|
|
141
|
+
(otherwise it will only be searchable).
|
|
142
|
+
|
|
143
|
+
Example
|
|
144
|
+
|
|
145
|
+
require 'lucene'
|
|
146
|
+
include Lucene
|
|
147
|
+
|
|
148
|
+
index = Index.new('var/myindex') # store the index at dir: var/myindex
|
|
149
|
+
index.field_infos[:id][:type] = Fixnum
|
|
150
|
+
index.field_infos[:name][:store] = true # store this field
|
|
151
|
+
|
|
152
|
+
index << {:id=>1, :name=>'foo'} # notice 1 is not a string now
|
|
153
|
+
|
|
154
|
+
index.commit
|
|
155
|
+
|
|
156
|
+
# find that document, hits is a ruby Enumeration of documents
|
|
157
|
+
hits = index.find('name' => 'foo')
|
|
158
|
+
|
|
159
|
+
# let say hits only contains one document so we can use doc[0] for that one
|
|
160
|
+
# that document contains all stored fields (see below)
|
|
161
|
+
doc[0][:id] # => 1
|
|
162
|
+
doc[0][:name] # => 'foo'
|
|
163
|
+
|
|
164
|
+
=== Setting field infos
|
|
165
|
+
|
|
166
|
+
As shown above you can set field infos like this
|
|
167
|
+
|
|
168
|
+
index.field_infos[:id][:type] = Fixnum
|
|
169
|
+
|
|
170
|
+
Or you can set several properties like this:
|
|
171
|
+
|
|
172
|
+
index.field_infos[:id] = {:type => Fixnum, :store => true}
|
|
173
|
+
|
|
174
|
+
==== Tokenized
|
|
175
|
+
|
|
176
|
+
Field infos can be used to specify if the should be tokenized.
|
|
177
|
+
If this value is not set then the entire content of the field will be considered as a single term.
|
|
178
|
+
|
|
179
|
+
Example
|
|
180
|
+
|
|
181
|
+
index.field_infos[:text][:tokenized] = true
|
|
182
|
+
|
|
183
|
+
If not specified, the default is 'false'
|
|
184
|
+
|
|
185
|
+
==== Analyzer
|
|
186
|
+
|
|
187
|
+
Field infos can also be used to set which analyzer should be used.
|
|
188
|
+
If none is specified, the default analyzer - org.apache.lucene.analysis.standard.StandardAnalyzer (:standard) will be used.
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
index.field_infos[:code][:tokenized] = false
|
|
192
|
+
index.field_infos[:code][:analyzer] = :standard
|
|
193
|
+
|
|
194
|
+
The following analyzer is supported
|
|
195
|
+
* :standard (default) - org.apache.lucene.analysis.standard.StandardAnalyzer
|
|
196
|
+
* :keyword - org.apache.lucene.analysis.KeywordAnalyzer
|
|
197
|
+
* :simple - org.apache.lucene.analysis.SimpleAnalyzer
|
|
198
|
+
* :whitespace - org.apache.lucene.analysis.WhitespaceAnalyzer
|
|
199
|
+
* :stop - org.apache.lucene.analysis.StopAnalyzer
|
|
200
|
+
|
|
201
|
+
For more info, check the Lucene documentation, http://lucene.apache.org/java/docs/
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
=== Simple Queries
|
|
205
|
+
|
|
206
|
+
Lucene.rb support search in several fields:
|
|
207
|
+
Example:
|
|
208
|
+
|
|
209
|
+
# finds all document having both name 'foo' and age 42
|
|
210
|
+
hits = index.find('name' => 'foo', :age=>42)
|
|
211
|
+
|
|
212
|
+
Range queries:
|
|
213
|
+
|
|
214
|
+
# finds all document having both name 'foo' and age between 3 and 30
|
|
215
|
+
hits = index.find('name' => 'foo', :age=>3..30)
|
|
216
|
+
|
|
217
|
+
=== Lucene Queries
|
|
218
|
+
|
|
219
|
+
If the query is string then the string is a Lucene query.
|
|
220
|
+
|
|
221
|
+
hits = index.find('name:foo')
|
|
222
|
+
|
|
223
|
+
For more information see:
|
|
224
|
+
http://lucene.apache.org/java/2_4_0/queryparsersyntax.html
|
|
225
|
+
|
|
226
|
+
=== Advanced Queries (DSL)
|
|
227
|
+
|
|
228
|
+
The queries above can also be written in a lucene.rb DSL:
|
|
229
|
+
|
|
230
|
+
hits = index.find { (name == 'andreas') & (foo == 'bar')}
|
|
231
|
+
|
|
232
|
+
Expression with OR (|) is supported, example
|
|
233
|
+
|
|
234
|
+
# find all documents with name 'andreas' or age between 30 and 40
|
|
235
|
+
hits = index.find { (name == 'andreas') | (age == 30..40)}
|
|
236
|
+
|
|
237
|
+
=== Sorting
|
|
238
|
+
|
|
239
|
+
Sorting is specified by the 'sort_by' parameter
|
|
240
|
+
Example:
|
|
241
|
+
|
|
242
|
+
hits = index.find(:name => 'foo', :sort_by=>:category)
|
|
243
|
+
|
|
244
|
+
To sort by several fields:
|
|
245
|
+
|
|
246
|
+
hits = index.find(:name => 'foo', :sort_by=>[:category, :country])
|
|
247
|
+
|
|
248
|
+
Example sort order:
|
|
249
|
+
|
|
250
|
+
hits = index.find(:name => 'foo', :sort_by=>[Desc[:category, :country], Asc[:city]])
|
|
251
|
+
|
|
252
|
+
=== Thread-safety
|
|
253
|
+
|
|
254
|
+
The Lucene::Index is thread safe.
|
|
255
|
+
It guarantees that an index is not updated from two threads at the same time.
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
=== Lucene Transactions
|
|
259
|
+
|
|
260
|
+
Use the Lucene::Transaction in order to do atomic commits.
|
|
261
|
+
By using a transaction you do not need to call the Index.commit method.
|
|
262
|
+
|
|
263
|
+
Example:
|
|
264
|
+
|
|
265
|
+
Transaction.run do |t|
|
|
266
|
+
index = Index.new('var/index/foo')
|
|
267
|
+
index << { id=>42, :name=>'andreas'}
|
|
268
|
+
t.failure # rollback
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
result = index.find('name' => 'andreas')
|
|
272
|
+
result.size.should == 0
|
|
273
|
+
|
|
274
|
+
You can find uncommitted documents with the uncommitted index property.
|
|
275
|
+
|
|
276
|
+
Example:
|
|
277
|
+
|
|
278
|
+
index = Index.new('var/index/foo')
|
|
279
|
+
index.uncommited #=> [document1, document2]
|
|
280
|
+
|
|
281
|
+
Notice that even if it looks like a new Index instance object was created the index.uncommitted
|
|
282
|
+
may return a non-empty array. This is because Index.new is a singleton - a new instance object is not created.
|
|
283
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rake'
|
|
4
|
+
require 'rdoc/task'
|
|
5
|
+
|
|
6
|
+
require "lucene/version"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def assert_committed
|
|
10
|
+
status = %x{git status}
|
|
11
|
+
fail("Can't release gem unless everything is committed") unless status =~ /nothing to commit \(working directory clean\)|nothing added to commit but untracked files present/
|
|
12
|
+
end
|
|
13
|
+
desc "create the gemspec"
|
|
14
|
+
task :build do
|
|
15
|
+
system "gem build lucene.gemspec"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
desc "release gem to gemcutter"
|
|
19
|
+
task :release => :build do
|
|
20
|
+
assert_committed
|
|
21
|
+
system "gem push lucene-#{Lucene::VERSION}.gem"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
desc "Generate documentation for Neo4j.rb"
|
|
25
|
+
RDoc::Task.new do |rdoc|
|
|
26
|
+
rdoc.rdoc_dir = 'doc/rdoc'
|
|
27
|
+
rdoc.title = "Lucene.rb Documentation #{Lucene::VERSION}"
|
|
28
|
+
rdoc.options << '-f' << 'horo'
|
|
29
|
+
rdoc.options << '-c' << 'utf-8'
|
|
30
|
+
rdoc.options << '-m' << 'README.rdoc'
|
|
31
|
+
|
|
32
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
33
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
34
|
+
end
|
|
35
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'neo4j'
|
|
5
|
+
require 'neo4j/extensions/activemodel'
|
|
6
|
+
|
|
7
|
+
class Person
|
|
8
|
+
include Neo4j::NodeMixin
|
|
9
|
+
include ActiveModel::Serializers::JSON
|
|
10
|
+
include ActiveModel::Serializers::Xml
|
|
11
|
+
|
|
12
|
+
property :first_name
|
|
13
|
+
property :last_name
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Neo4j::Transaction.run do
|
|
19
|
+
person = Person.new :first_name => 'jimmy', :last_name => 'smith'
|
|
20
|
+
|
|
21
|
+
puts "HASH: #{person.serializable_hash}"
|
|
22
|
+
puts "JSON: #{person.to_json}"
|
|
23
|
+
puts "XML : #{person.to_xml}"
|
|
24
|
+
|
|
25
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'neo4j'
|
|
5
|
+
require 'neo4j/extensions/activemodel'
|
|
6
|
+
|
|
7
|
+
class Person
|
|
8
|
+
include Neo4j::NodeMixin
|
|
9
|
+
include ActiveModel::Validations
|
|
10
|
+
|
|
11
|
+
property :first_name
|
|
12
|
+
property :last_name
|
|
13
|
+
|
|
14
|
+
validates_presence_of :first_name, :last_name
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Neo4j::Transaction.run do
|
|
19
|
+
person = Person.new
|
|
20
|
+
|
|
21
|
+
puts person.valid?
|
|
22
|
+
puts person.errors.inspect
|
|
23
|
+
person.first_name = "Hej"
|
|
24
|
+
person.last_name = "hop"
|
|
25
|
+
puts person.valid?
|
|
26
|
+
end
|