pduey-sunspot_rails 1.2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/History.txt +54 -0
- data/LICENSE +18 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +282 -0
- data/Rakefile +18 -0
- data/TESTING.md +35 -0
- data/TODO +8 -0
- data/VERSION.yml +4 -0
- data/dev_tasks/rdoc.rake +24 -0
- data/dev_tasks/release.rake +4 -0
- data/dev_tasks/spec.rake +27 -0
- data/dev_tasks/todo.rake +4 -0
- data/generators/sunspot/sunspot_generator.rb +9 -0
- data/generators/sunspot/templates/sunspot.yml +18 -0
- data/install.rb +1 -0
- data/lib/generators/sunspot_rails.rb +9 -0
- data/lib/generators/sunspot_rails/install/install_generator.rb +13 -0
- data/lib/generators/sunspot_rails/install/templates/config/sunspot.yml +17 -0
- data/lib/sunspot/rails.rb +63 -0
- data/lib/sunspot/rails/adapters.rb +83 -0
- data/lib/sunspot/rails/configuration.rb +323 -0
- data/lib/sunspot/rails/init.rb +5 -0
- data/lib/sunspot/rails/log_subscriber.rb +33 -0
- data/lib/sunspot/rails/railtie.rb +36 -0
- data/lib/sunspot/rails/railties/controller_runtime.rb +36 -0
- data/lib/sunspot/rails/request_lifecycle.rb +36 -0
- data/lib/sunspot/rails/searchable.rb +420 -0
- data/lib/sunspot/rails/server.rb +173 -0
- data/lib/sunspot/rails/solr_instrumentation.rb +20 -0
- data/lib/sunspot/rails/solr_logging.rb +62 -0
- data/lib/sunspot/rails/spec_helper.rb +26 -0
- data/lib/sunspot/rails/stub_session_proxy.rb +142 -0
- data/lib/sunspot/rails/tasks.rb +66 -0
- data/lib/sunspot_rails.rb +12 -0
- data/spec/configuration_spec.rb +173 -0
- data/spec/model_lifecycle_spec.rb +63 -0
- data/spec/model_spec.rb +478 -0
- data/spec/rails2/.gitignore +2 -0
- data/spec/rails2/Gemfile +15 -0
- data/spec/rails2/Rakefile +17 -0
- data/spec/rails2/app/controllers/application.rb +10 -0
- data/spec/rails2/app/controllers/application_controller.rb +10 -0
- data/spec/rails2/app/controllers/posts_controller.rb +6 -0
- data/spec/rails2/app/models/author.rb +8 -0
- data/spec/rails2/app/models/blog.rb +12 -0
- data/spec/rails2/app/models/location.rb +2 -0
- data/spec/rails2/app/models/photo_post.rb +2 -0
- data/spec/rails2/app/models/post.rb +11 -0
- data/spec/rails2/app/models/post_with_auto.rb +10 -0
- data/spec/rails2/app/models/post_with_conditional_index.rb +13 -0
- data/spec/rails2/app/models/post_with_default_scope.rb +11 -0
- data/spec/rails2/config/boot.rb +116 -0
- data/spec/rails2/config/database.yml +4 -0
- data/spec/rails2/config/environment.rb +41 -0
- data/spec/rails2/config/environments/development.rb +27 -0
- data/spec/rails2/config/environments/test.rb +27 -0
- data/spec/rails2/config/initializers/new_rails_defaults.rb +19 -0
- data/spec/rails2/config/initializers/session_store.rb +15 -0
- data/spec/rails2/config/preinitializer.rb +19 -0
- data/spec/rails2/config/routes.rb +43 -0
- data/spec/rails2/config/sunspot.yml +19 -0
- data/spec/rails2/db/schema.rb +27 -0
- data/spec/rails2/script/console +3 -0
- data/spec/rails3/.gitignore +4 -0
- data/spec/rails3/Gemfile +15 -0
- data/spec/rails3/README +281 -0
- data/spec/rails3/Rakefile +7 -0
- data/spec/rails3/app/controllers/application.rb +4 -0
- data/spec/rails3/app/controllers/application_controller.rb +4 -0
- data/spec/rails3/app/controllers/posts_controller.rb +6 -0
- data/spec/rails3/app/models/author.rb +8 -0
- data/spec/rails3/app/models/blog.rb +12 -0
- data/spec/rails3/app/models/location.rb +2 -0
- data/spec/rails3/app/models/photo_post.rb +2 -0
- data/spec/rails3/app/models/post.rb +11 -0
- data/spec/rails3/app/models/post_with_auto.rb +10 -0
- data/spec/rails3/app/models/post_with_conditional_index.rb +13 -0
- data/spec/rails3/app/models/post_with_default_scope.rb +11 -0
- data/spec/rails3/config.ru +4 -0
- data/spec/rails3/config/application.rb +46 -0
- data/spec/rails3/config/boot.rb +13 -0
- data/spec/rails3/config/database.yml +22 -0
- data/spec/rails3/config/environment.rb +5 -0
- data/spec/rails3/config/environments/development.rb +19 -0
- data/spec/rails3/config/environments/test.rb +19 -0
- data/spec/rails3/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails3/config/initializers/inflections.rb +10 -0
- data/spec/rails3/config/initializers/mime_types.rb +5 -0
- data/spec/rails3/config/initializers/new_rails_defaults.rb +19 -0
- data/spec/rails3/config/initializers/secret_token.rb +7 -0
- data/spec/rails3/config/initializers/session_store.rb +8 -0
- data/spec/rails3/config/locales/en.yml +5 -0
- data/spec/rails3/config/routes.rb +59 -0
- data/spec/rails3/config/sunspot.yml +19 -0
- data/spec/rails3/db/schema.rb +27 -0
- data/spec/rails3/script/console +3 -0
- data/spec/rails3/script/rails +6 -0
- data/spec/rails3/solr/.gitignore +1 -0
- data/spec/rails3/solr/conf/elevate.xml +36 -0
- data/spec/rails3/solr/conf/schema.xml +238 -0
- data/spec/rails3/solr/conf/solrconfig.xml +938 -0
- data/spec/rails3/solr/conf/spellings.txt +2 -0
- data/spec/rails3/solr/conf/stopwords.txt +58 -0
- data/spec/rails3/solr/conf/synonyms.txt +31 -0
- data/spec/rails3/solr/lib/lucene-spatial-2.9.1.jar +0 -0
- data/spec/rails3/solr/lib/solr-spatial-light-0.0.6.jar +0 -0
- data/spec/request_lifecycle_spec.rb +61 -0
- data/spec/schema.rb +27 -0
- data/spec/server_spec.rb +37 -0
- data/spec/session_spec.rb +24 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/stub_session_proxy_spec.rb +122 -0
- data/sunspot_rails.gemspec +44 -0
- metadata +322 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
module MockApp
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Add additional load paths for your own custom dirs
|
16
|
+
# config.load_paths += %W( #{config.root}/extras )
|
17
|
+
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
+
|
22
|
+
# Activate observers that should always be running
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
+
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
+
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
+
# config.i18n.default_locale = :de
|
32
|
+
|
33
|
+
# Configure generators values. Many other options are available, be sure to check the documentation.
|
34
|
+
# config.generators do |g|
|
35
|
+
# g.orm :active_record
|
36
|
+
# g.template_engine :erb
|
37
|
+
# g.test_framework :test_unit, :fixture => true
|
38
|
+
# end
|
39
|
+
|
40
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
41
|
+
config.encoding = "utf-8"
|
42
|
+
|
43
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
44
|
+
config.filter_parameters += [:password]
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
begin
|
6
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
+
require 'bundler'
|
8
|
+
Bundler.setup
|
9
|
+
rescue Bundler::GemNotFound => e
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Try running `bundle install`."
|
12
|
+
exit!
|
13
|
+
end if File.exist?(gemfile)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,19 @@
|
|
1
|
+
MockApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
# config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
config.active_support.deprecation = :stderr
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
MockApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
# config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
config.active_support.deprecation = :stderr
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
4
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
5
|
+
|
6
|
+
if defined?(ActiveRecord)
|
7
|
+
# Include Active Record class name as root for JSON serialized output.
|
8
|
+
ActiveRecord::Base.include_root_in_json = true
|
9
|
+
|
10
|
+
# Store the full class name (including module namespace) in STI type column.
|
11
|
+
ActiveRecord::Base.store_full_sti_class = true
|
12
|
+
end
|
13
|
+
|
14
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
15
|
+
ActiveSupport.use_standard_json_time_format = true
|
16
|
+
|
17
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
18
|
+
# if you're including raw json in an HTML page.
|
19
|
+
ActiveSupport.escape_html_entities_in_json = false
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Rails.application.config.secret_token = 'f01dfb2a86ad760b12653befffafc5472bbfa5765b8730558feb4be9701c198cb8ca535a653cd55adf3c18ea7301fef07a76607ebb833d64c38d83b8150d3223'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Rails.application.config.session_store :cookie_store, :key => '_mock_app_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rake db:sessions:create")
|
8
|
+
# Rails.application.config.session_store :active_record_store
|
@@ -0,0 +1,59 @@
|
|
1
|
+
MockApp::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get :short
|
20
|
+
# post :toggle
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get :sold
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get :recent, :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
resources :posts, :only => :create
|
59
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
test:
|
2
|
+
solr:
|
3
|
+
hostname: localhost
|
4
|
+
port: 8980
|
5
|
+
development:
|
6
|
+
solr:
|
7
|
+
hostname: localhost
|
8
|
+
port: 8981
|
9
|
+
config_test:
|
10
|
+
solr:
|
11
|
+
hostname: some.host
|
12
|
+
port: 1234
|
13
|
+
path: /solr/idx
|
14
|
+
log_level: WARNING
|
15
|
+
data_path: /my_superior_path/data
|
16
|
+
pid_dir: /my_superior_path/pids
|
17
|
+
solr_home: /my_superior_path
|
18
|
+
auto_commit_after_request: false
|
19
|
+
auto_commit_after_delete_request: true
|
@@ -0,0 +1,27 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
create_table :posts, :force => true do |t|
|
3
|
+
t.string :title
|
4
|
+
t.string :type
|
5
|
+
t.integer :location_id
|
6
|
+
t.text :body
|
7
|
+
t.references :blog
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table :locations, :force => true do |t|
|
12
|
+
t.float :lat
|
13
|
+
t.float :lng
|
14
|
+
end
|
15
|
+
|
16
|
+
create_table :blogs, :force => true do |t|
|
17
|
+
t.string :name
|
18
|
+
t.string :subdomain
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
|
22
|
+
create_table :writers, :force => true, :primary_key => :writer_id do |t|
|
23
|
+
t.string :name
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1 @@
|
|
1
|
+
data
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
|
19
|
+
<!-- If this file is found in the config directory, it will only be
|
20
|
+
loaded once at startup. If it is found in Solr's data
|
21
|
+
directory, it will be re-loaded every commit.
|
22
|
+
-->
|
23
|
+
|
24
|
+
<elevate>
|
25
|
+
<query text="foo bar">
|
26
|
+
<doc id="1" />
|
27
|
+
<doc id="2" />
|
28
|
+
<doc id="3" />
|
29
|
+
</query>
|
30
|
+
|
31
|
+
<query text="ipod">
|
32
|
+
<doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
|
33
|
+
<doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
|
34
|
+
</query>
|
35
|
+
|
36
|
+
</elevate>
|
@@ -0,0 +1,238 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
<!--
|
19
|
+
This is the Solr schema file. This file should be named "schema.xml" and
|
20
|
+
should be in the conf directory under the solr home
|
21
|
+
(i.e. ./solr/conf/schema.xml by default)
|
22
|
+
or located where the classloader for the Solr webapp can find it.
|
23
|
+
|
24
|
+
This example schema is the recommended starting point for users.
|
25
|
+
It should be kept correct and concise, usable out-of-the-box.
|
26
|
+
|
27
|
+
For more information, on how to customize this file, please see
|
28
|
+
http://wiki.apache.org/solr/SchemaXml
|
29
|
+
|
30
|
+
PERFORMANCE NOTE: this schema includes many optional features and should not
|
31
|
+
be used for benchmarking. To improve performance one could
|
32
|
+
- set stored="false" for all fields possible (esp large fields) when you
|
33
|
+
only need to search on the field but don't need to return the original
|
34
|
+
value.
|
35
|
+
- set indexed="false" if you don't need to search on the field, but only
|
36
|
+
return the field as a result of searching on other indexed fields.
|
37
|
+
- remove all unneeded copyField statements
|
38
|
+
- for best index size and searching performance, set "index" to false
|
39
|
+
for all general text fields, use copyField to copy them to the
|
40
|
+
catchall "text" field, and use that for searching.
|
41
|
+
- For maximum indexing performance, use the StreamingUpdateSolrServer
|
42
|
+
java client.
|
43
|
+
- Remember to run the JVM in server mode, and use a higher logging level
|
44
|
+
that avoids logging every request
|
45
|
+
-->
|
46
|
+
<schema name="sunspot" version="1.0">
|
47
|
+
<types>
|
48
|
+
<!-- field type definitions. The "name" attribute is
|
49
|
+
just a label to be used by field definitions. The "class"
|
50
|
+
attribute and any other attributes determine the real
|
51
|
+
behavior of the fieldType.
|
52
|
+
Class names starting with "solr" refer to java classes in the
|
53
|
+
org.apache.solr.analysis package.
|
54
|
+
-->
|
55
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
56
|
+
<fieldType name="string" class="solr.StrField" omitNorms="true"/>
|
57
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
58
|
+
<fieldType name="tdouble" class="solr.TrieDoubleField" omitNorms="true"/>
|
59
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
60
|
+
<fieldType name="rand" class="solr.RandomSortField" omitNorms="true"/>
|
61
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
62
|
+
<fieldType name="text" class="solr.TextField" omitNorms="false">
|
63
|
+
<analyzer>
|
64
|
+
<tokenizer class="solr.StandardTokenizerFactory"/>
|
65
|
+
<filter class="solr.StandardFilterFactory"/>
|
66
|
+
<filter class="solr.LowerCaseFilterFactory"/>
|
67
|
+
</analyzer>
|
68
|
+
</fieldType>
|
69
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
70
|
+
<fieldType name="boolean" class="solr.BoolField" omitNorms="true"/>
|
71
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
72
|
+
<fieldType name="date" class="solr.DateField" omitNorms="true"/>
|
73
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
74
|
+
<fieldType name="sdouble" class="solr.SortableDoubleField" omitNorms="true"/>
|
75
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
76
|
+
<fieldType name="sfloat" class="solr.SortableFloatField" omitNorms="true"/>
|
77
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
78
|
+
<fieldType name="sint" class="solr.SortableIntField" omitNorms="true"/>
|
79
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
80
|
+
<fieldType name="slong" class="solr.SortableLongField" omitNorms="true"/>
|
81
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
82
|
+
<fieldType name="tint" class="solr.TrieIntField" omitNorms="true"/>
|
83
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
84
|
+
<fieldType name="tfloat" class="solr.TrieFloatField" omitNorms="true"/>
|
85
|
+
<!-- *** This fieldType is used by Sunspot! *** -->
|
86
|
+
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true"/>
|
87
|
+
</types>
|
88
|
+
<fields>
|
89
|
+
<!-- Valid attributes for fields:
|
90
|
+
name: mandatory - the name for the field
|
91
|
+
type: mandatory - the name of a previously defined type from the
|
92
|
+
<types> section
|
93
|
+
indexed: true if this field should be indexed (searchable or sortable)
|
94
|
+
stored: true if this field should be retrievable
|
95
|
+
compressed: [false] if this field should be stored using gzip compression
|
96
|
+
(this will only apply if the field type is compressable; among
|
97
|
+
the standard field types, only TextField and StrField are)
|
98
|
+
multiValued: true if this field may contain multiple values per document
|
99
|
+
omitNorms: (expert) set to true to omit the norms associated with
|
100
|
+
this field (this disables length normalization and index-time
|
101
|
+
boosting for the field, and saves some memory). Only full-text
|
102
|
+
fields or fields that need an index-time boost need norms.
|
103
|
+
termVectors: [false] set to true to store the term vector for a
|
104
|
+
given field.
|
105
|
+
When using MoreLikeThis, fields used for similarity should be
|
106
|
+
stored for best performance.
|
107
|
+
termPositions: Store position information with the term vector.
|
108
|
+
This will increase storage costs.
|
109
|
+
termOffsets: Store offset information with the term vector. This
|
110
|
+
will increase storage costs.
|
111
|
+
default: a value that should be used if no value is specified
|
112
|
+
when adding a document.
|
113
|
+
-->
|
114
|
+
<!-- *** This field is used by Sunspot! *** -->
|
115
|
+
<field name="id" stored="true" type="string" multiValued="false" indexed="true"/>
|
116
|
+
<!-- *** This field is used by Sunspot! *** -->
|
117
|
+
<field name="type" stored="false" type="string" multiValued="true" indexed="true"/>
|
118
|
+
<!-- *** This field is used by Sunspot! *** -->
|
119
|
+
<field name="class_name" stored="false" type="string" multiValued="false" indexed="true"/>
|
120
|
+
<!-- *** This field is used by Sunspot! *** -->
|
121
|
+
<field name="text" stored="false" type="string" multiValued="true" indexed="true"/>
|
122
|
+
<!-- *** This field is used by Sunspot! *** -->
|
123
|
+
<field name="lat" stored="true" type="tdouble" multiValued="false" indexed="true"/>
|
124
|
+
<!-- *** This field is used by Sunspot! *** -->
|
125
|
+
<field name="lng" stored="true" type="tdouble" multiValued="false" indexed="true"/>
|
126
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
127
|
+
<dynamicField name="random_*" stored="false" type="rand" multiValued="false" indexed="true"/>
|
128
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
129
|
+
<dynamicField name="_local*" stored="false" type="tdouble" multiValued="false" indexed="true"/>
|
130
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
131
|
+
<dynamicField name="*_text" stored="false" type="text" multiValued="true" indexed="true"/>
|
132
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
133
|
+
<dynamicField name="*_texts" stored="true" type="text" multiValued="true" indexed="true"/>
|
134
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
135
|
+
<dynamicField name="*_b" stored="false" type="boolean" multiValued="false" indexed="true"/>
|
136
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
137
|
+
<dynamicField name="*_bm" stored="false" type="boolean" multiValued="true" indexed="true"/>
|
138
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
139
|
+
<dynamicField name="*_bs" stored="true" type="boolean" multiValued="false" indexed="true"/>
|
140
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
141
|
+
<dynamicField name="*_bms" stored="true" type="boolean" multiValued="true" indexed="true"/>
|
142
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
143
|
+
<dynamicField name="*_d" stored="false" type="date" multiValued="false" indexed="true"/>
|
144
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
145
|
+
<dynamicField name="*_dm" stored="false" type="date" multiValued="true" indexed="true"/>
|
146
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
147
|
+
<dynamicField name="*_ds" stored="true" type="date" multiValued="false" indexed="true"/>
|
148
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
149
|
+
<dynamicField name="*_dms" stored="true" type="date" multiValued="true" indexed="true"/>
|
150
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
151
|
+
<dynamicField name="*_e" stored="false" type="sdouble" multiValued="false" indexed="true"/>
|
152
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
153
|
+
<dynamicField name="*_em" stored="false" type="sdouble" multiValued="true" indexed="true"/>
|
154
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
155
|
+
<dynamicField name="*_es" stored="true" type="sdouble" multiValued="false" indexed="true"/>
|
156
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
157
|
+
<dynamicField name="*_ems" stored="true" type="sdouble" multiValued="true" indexed="true"/>
|
158
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
159
|
+
<dynamicField name="*_f" stored="false" type="sfloat" multiValued="false" indexed="true"/>
|
160
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
161
|
+
<dynamicField name="*_fm" stored="false" type="sfloat" multiValued="true" indexed="true"/>
|
162
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
163
|
+
<dynamicField name="*_fs" stored="true" type="sfloat" multiValued="false" indexed="true"/>
|
164
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
165
|
+
<dynamicField name="*_fms" stored="true" type="sfloat" multiValued="true" indexed="true"/>
|
166
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
167
|
+
<dynamicField name="*_i" stored="false" type="sint" multiValued="false" indexed="true"/>
|
168
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
169
|
+
<dynamicField name="*_im" stored="false" type="sint" multiValued="true" indexed="true"/>
|
170
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
171
|
+
<dynamicField name="*_is" stored="true" type="sint" multiValued="false" indexed="true"/>
|
172
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
173
|
+
<dynamicField name="*_ims" stored="true" type="sint" multiValued="true" indexed="true"/>
|
174
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
175
|
+
<dynamicField name="*_l" stored="false" type="slong" multiValued="false" indexed="true"/>
|
176
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
177
|
+
<dynamicField name="*_lm" stored="false" type="slong" multiValued="true" indexed="true"/>
|
178
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
179
|
+
<dynamicField name="*_ls" stored="true" type="slong" multiValued="false" indexed="true"/>
|
180
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
181
|
+
<dynamicField name="*_lms" stored="true" type="slong" multiValued="true" indexed="true"/>
|
182
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
183
|
+
<dynamicField name="*_s" stored="false" type="string" multiValued="false" indexed="true"/>
|
184
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
185
|
+
<dynamicField name="*_sm" stored="false" type="string" multiValued="true" indexed="true"/>
|
186
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
187
|
+
<dynamicField name="*_ss" stored="true" type="string" multiValued="false" indexed="true"/>
|
188
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
189
|
+
<dynamicField name="*_sms" stored="true" type="string" multiValued="true" indexed="true"/>
|
190
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
191
|
+
<dynamicField name="*_it" stored="false" type="tint" multiValued="false" indexed="true"/>
|
192
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
193
|
+
<dynamicField name="*_itm" stored="false" type="tint" multiValued="true" indexed="true"/>
|
194
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
195
|
+
<dynamicField name="*_its" stored="true" type="tint" multiValued="false" indexed="true"/>
|
196
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
197
|
+
<dynamicField name="*_itms" stored="true" type="tint" multiValued="true" indexed="true"/>
|
198
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
199
|
+
<dynamicField name="*_ft" stored="false" type="tfloat" multiValued="false" indexed="true"/>
|
200
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
201
|
+
<dynamicField name="*_ftm" stored="false" type="tfloat" multiValued="true" indexed="true"/>
|
202
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
203
|
+
<dynamicField name="*_fts" stored="true" type="tfloat" multiValued="false" indexed="true"/>
|
204
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
205
|
+
<dynamicField name="*_ftms" stored="true" type="tfloat" multiValued="true" indexed="true"/>
|
206
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
207
|
+
<dynamicField name="*_dt" stored="false" type="tdate" multiValued="false" indexed="true"/>
|
208
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
209
|
+
<dynamicField name="*_dtm" stored="false" type="tdate" multiValued="true" indexed="true"/>
|
210
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
211
|
+
<dynamicField name="*_dts" stored="true" type="tdate" multiValued="false" indexed="true"/>
|
212
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
213
|
+
<dynamicField name="*_dtms" stored="true" type="tdate" multiValued="true" indexed="true"/>
|
214
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
215
|
+
<dynamicField name="*_textv" stored="false" termVectors="true" type="text" multiValued="true" indexed="true"/>
|
216
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
217
|
+
<dynamicField name="*_textsv" stored="true" termVectors="true" type="text" multiValued="true" indexed="true"/>
|
218
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
219
|
+
<dynamicField name="*_et" stored="false" termVectors="true" type="tdouble" multiValued="false" indexed="true"/>
|
220
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
221
|
+
<dynamicField name="*_etm" stored="false" termVectors="true" type="tdouble" multiValued="true" indexed="true"/>
|
222
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
223
|
+
<dynamicField name="*_ets" stored="true" termVectors="true" type="tdouble" multiValued="false" indexed="true"/>
|
224
|
+
<!-- *** This dynamicField is used by Sunspot! *** -->
|
225
|
+
<dynamicField name="*_etms" stored="true" termVectors="true" type="tdouble" multiValued="true" indexed="true"/>
|
226
|
+
</fields>
|
227
|
+
<!-- Field to use to determine and enforce document uniqueness.
|
228
|
+
Unless this field is marked with required="false", it will be a required field
|
229
|
+
-->
|
230
|
+
<uniqueKey>id</uniqueKey>
|
231
|
+
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
|
232
|
+
<defaultSearchField>text</defaultSearchField>
|
233
|
+
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
|
234
|
+
<solrQueryParser defaultOperator="AND"/>
|
235
|
+
<!-- copyField commands copy one field to another at the time a document
|
236
|
+
is added to the index. It's used either to index the same field differently,
|
237
|
+
or to add multiple fields to the same field for easier/faster searching. -->
|
238
|
+
</schema>
|