diff --git a/.gitignore b/.gitignore index 00c5f12f6..b9333bb59 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ bin .ruby-version .ruby-gemset gemfiles/*.gemfile.lock +/fcrepo4-data diff --git a/README.md b/README.md index b6361e859..423044574 100644 --- a/README.md +++ b/README.md @@ -63,12 +63,8 @@ You can test ActiveFedora using the same process as our continuous integration server. To do that, unzip a copy of hydra-jetty first. This includes copies of Fedora and Solr which are used during the testing process. -```bash -rake jetty:unzip -``` - -Once hydra-jetty is unzipped, the ci rake task will spin up jetty, -import the fixtures, and run the tests for you. +The `ci` rake task will download solr and fedora, start them, +and run the tests for you. ```bash rake active_fedora:ci @@ -76,18 +72,21 @@ rake active_fedora:ci ### Testing Manually -If you want to run the tests manually, follow these instructions. +If you want to run the tests manually, follow these instructions: + +```bash +solr_wrapper -d solr/config/ --collection_name hydra-test +``` + +You can switch `hydra-test` to `hydra-dev` if you want to create a collection for development. -You need to have a copy of hydra-jetty running. To do this, download a -working copy of -[hydra-jetty](https://github.com/projecthydra/hydra-jetty), cd into its -root and run: +To start FCRepo, open another shell and run: ```bash -java -jar start.jar +fedora_wrapper -p 8984 ``` -Now you’re ready to run the tests. In the directory where active_fedora +Now you’re ready to run the tests. In the directory where active\_fedora is installed, run: ```bash diff --git a/Rakefile b/Rakefile index 06e890536..f6d37f4d1 100644 --- a/Rakefile +++ b/Rakefile @@ -9,7 +9,7 @@ load "lib/tasks/active_fedora_dev.rake" CLEAN.include %w(**/.DS_Store tmp *.log *.orig *.tmp **/*~) desc 'setup jetty and run tests' -task ci: ['jetty:clean', 'active_fedora:ci'] +task ci: ['active_fedora:ci'] desc 'run tests' task spec: ['active_fedora:rubocop', 'active_fedora:rspec'] task rcov: ['active_fedora:rcov'] diff --git a/active-fedora.gemspec b/active-fedora.gemspec index 57fd638dc..9c85fa950 100644 --- a/active-fedora.gemspec +++ b/active-fedora.gemspec @@ -27,7 +27,8 @@ Gem::Specification.new do |s| s.add_development_dependency "rdoc" s.add_development_dependency "yard" s.add_development_dependency "rake" - s.add_development_dependency "jettywrapper", ">= 2.0.0" + s.add_development_dependency "solr_wrapper", "~> 0.4" + s.add_development_dependency 'fcrepo_wrapper', '~> 0.1' s.add_development_dependency "rspec", "~> 3.0" s.add_development_dependency "rspec-its" s.add_development_dependency "equivalent-xml" diff --git a/config/fedora.yml b/config/fedora.yml index 8a141d4c9..a3425daa3 100644 --- a/config/fedora.yml +++ b/config/fedora.yml @@ -1,12 +1,12 @@ development: user: fedoraAdmin password: fedoraAdmin - url: http://127.0.0.1:8983/fedora/rest + url: http://127.0.0.1:8984/rest base_path: /dev test: user: fedoraAdmin password: fedoraAdmin - url: http://localhost:8983/fedora/rest + url: http://localhost:8984/rest base_path: /test production: user: fedoraAdmin diff --git a/config/solr.yml b/config/solr.yml index b0c565693..279063fc1 100644 --- a/config/solr.yml +++ b/config/solr.yml @@ -1,15 +1,15 @@ development: default: - url: http://localhost:8983/solr/development + url: http://localhost:8983/solr/hydra-dev full_text: url: http://localhost:8983/solr/development -test: +test: default: - url: http://localhost:8983/solr/test + url: http://localhost:8983/solr/hydra-test full_text: url: http://localhost:8983/solr/test production: default: - url: http://localhost:8080/solr/production + url: http://localhost:8080/solr/production full_text: - url: http://localhost:8080/solr/production \ No newline at end of file + url: http://localhost:8080/solr/production diff --git a/lib/generators/active_fedora/config/fedora/templates/fedora.yml b/lib/generators/active_fedora/config/fedora/templates/fedora.yml index c1085139f..8d09e8c00 100644 --- a/lib/generators/active_fedora/config/fedora/templates/fedora.yml +++ b/lib/generators/active_fedora/config/fedora/templates/fedora.yml @@ -1,12 +1,12 @@ development: user: fedoraAdmin password: fedoraAdmin - url: http://127.0.0.1:8983/fedora/rest + url: http://127.0.0.1:8984/rest base_path: /dev test: user: fedoraAdmin password: fedoraAdmin - url: http://localhost:8983/fedora/rest + url: http://localhost:8984/rest base_path: /test production: user: fedoraAdmin diff --git a/lib/generators/active_fedora/config/solr/solr_generator.rb b/lib/generators/active_fedora/config/solr/solr_generator.rb index 02675be2d..be6880861 100644 --- a/lib/generators/active_fedora/config/solr/solr_generator.rb +++ b/lib/generators/active_fedora/config/solr/solr_generator.rb @@ -6,7 +6,6 @@ class Config::SolrGenerator < Rails::Generators::Base def generate # Overwrite the configuration files that Blacklight has installed - copy_file 'jetty.yml', 'config/jetty.yml', force: true copy_file 'solr.yml', 'config/solr.yml', force: true directory 'solr_conf', 'solr_conf' end diff --git a/lib/generators/active_fedora/config/solr/templates/jetty.yml b/lib/generators/active_fedora/config/solr/templates/jetty.yml deleted file mode 100644 index 7d2416c71..000000000 --- a/lib/generators/active_fedora/config/solr/templates/jetty.yml +++ /dev/null @@ -1,6 +0,0 @@ -default: - startup_wait: 90 - jetty_port: 8983 - java_opts: - - "-Xmx512m" - - "-XX:MaxPermSize=128m" diff --git a/lib/generators/active_fedora/config/solr/templates/solr.yml b/lib/generators/active_fedora/config/solr/templates/solr.yml index 63165767b..4a7dc6dab 100644 --- a/lib/generators/active_fedora/config/solr/templates/solr.yml +++ b/lib/generators/active_fedora/config/solr/templates/solr.yml @@ -1,7 +1,7 @@ # This is a sample config file that points to a solr server for each environment development: - url: http://localhost:8983/solr/development + url: http://localhost:8983/solr/hydra-dev test: - url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/test" %> + url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/hydra-test" %> production: url: http://your.production.server:8080/bl_solr/core0 diff --git a/lib/tasks/active_fedora_dev.rake b/lib/tasks/active_fedora_dev.rake index b2d7518fc..8d505e220 100644 --- a/lib/tasks/active_fedora_dev.rake +++ b/lib/tasks/active_fedora_dev.rake @@ -1,6 +1,7 @@ APP_ROOT = File.expand_path("#{File.dirname(__FILE__)}/../../") -require 'jettywrapper' +require 'solr_wrapper' +require 'fcrepo_wrapper' namespace :active_fedora do # Use yard to build docs @@ -50,14 +51,18 @@ namespace :active_fedora do desc "CI build" task :ci do ENV['environment'] = "test" - Rake::Task["active_fedora:configure_jetty"].invoke - jetty_params = Jettywrapper.load_config - error = Jettywrapper.wrap(jetty_params) do - Rake::Task['active_fedora:coverage'].invoke + # Rake::Task["active_fedora:configure_jetty"].invoke + # jetty_params = Jettywrapper.load_config + solr_params = { port: 8983, verbose: true, managed: true } + fcrepo_params = { port: 8984, verbose: true, managed: true } + error = nil + SolrWrapper.wrap(solr_params) do |solr| + solr.with_collection(name: 'hydra-test', dir: File.join(File.expand_path("../..", File.dirname(__FILE__)), "solr", "config")) do + FcrepoWrapper.wrap(fcrepo_params) do + Rake::Task['active_fedora:coverage'].invoke + end + end end - raise "test failures: #{error}" if error - # Only create documentation if the tests have passed - Rake::Task["active_fedora:doc"].invoke end desc "Execute specs with coverage" diff --git a/solr/config/_rest_managed.json b/solr/config/_rest_managed.json new file mode 100644 index 000000000..e7ada3f6e --- /dev/null +++ b/solr/config/_rest_managed.json @@ -0,0 +1,3 @@ +{ + "initArgs":{}, + "managedList":[]} \ No newline at end of file diff --git a/solr/config/admin-extra.html b/solr/config/admin-extra.html new file mode 100644 index 000000000..21b50901c --- /dev/null +++ b/solr/config/admin-extra.html @@ -0,0 +1,31 @@ + + + diff --git a/solr/config/elevate.xml b/solr/config/elevate.xml new file mode 100644 index 000000000..b91e75cec --- /dev/null +++ b/solr/config/elevate.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + diff --git a/solr/config/mapping-ISOLatin1Accent.txt b/solr/config/mapping-ISOLatin1Accent.txt new file mode 100644 index 000000000..186ca313d --- /dev/null +++ b/solr/config/mapping-ISOLatin1Accent.txt @@ -0,0 +1,246 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Syntax: +# "source" => "target" +# "source".length() > 0 (source cannot be empty.) +# "target".length() >= 0 (target can be empty.) + +# example: +# "??" => "A" +# "\u00C0" => "A" +# "\u00C0" => "\u0041" +# "??" => "ss" +# "\t" => " " +# "\n" => "" + +# ?? => A +"\u00C0" => "A" + +# ?? => A +"\u00C1" => "A" + +# ?? => A +"\u00C2" => "A" + +# ?? => A +"\u00C3" => "A" + +# ?? => A +"\u00C4" => "A" + +# ?? => A +"\u00C5" => "A" + +# ?? => AE +"\u00C6" => "AE" + +# ?? => C +"\u00C7" => "C" + +# ?? => E +"\u00C8" => "E" + +# ?? => E +"\u00C9" => "E" + +# ?? => E +"\u00CA" => "E" + +# ?? => E +"\u00CB" => "E" + +# ?? => I +"\u00CC" => "I" + +# ?? => I +"\u00CD" => "I" + +# ?? => I +"\u00CE" => "I" + +# ?? => I +"\u00CF" => "I" + +# ?? => IJ +"\u0132" => "IJ" + +# ?? => D +"\u00D0" => "D" + +# ?? => N +"\u00D1" => "N" + +# ?? => O +"\u00D2" => "O" + +# ?? => O +"\u00D3" => "O" + +# ?? => O +"\u00D4" => "O" + +# ?? => O +"\u00D5" => "O" + +# ?? => O +"\u00D6" => "O" + +# ?? => O +"\u00D8" => "O" + +# ?? => OE +"\u0152" => "OE" + +# ?? +"\u00DE" => "TH" + +# ?? => U +"\u00D9" => "U" + +# ?? => U +"\u00DA" => "U" + +# ?? => U +"\u00DB" => "U" + +# ?? => U +"\u00DC" => "U" + +# ?? => Y +"\u00DD" => "Y" + +# ?? => Y +"\u0178" => "Y" + +# ?? => a +"\u00E0" => "a" + +# ?? => a +"\u00E1" => "a" + +# ?? => a +"\u00E2" => "a" + +# ?? => a +"\u00E3" => "a" + +# ?? => a +"\u00E4" => "a" + +# ?? => a +"\u00E5" => "a" + +# ?? => ae +"\u00E6" => "ae" + +# ?? => c +"\u00E7" => "c" + +# ?? => e +"\u00E8" => "e" + +# ?? => e +"\u00E9" => "e" + +# ?? => e +"\u00EA" => "e" + +# ?? => e +"\u00EB" => "e" + +# ?? => i +"\u00EC" => "i" + +# ?? => i +"\u00ED" => "i" + +# ?? => i +"\u00EE" => "i" + +# ?? => i +"\u00EF" => "i" + +# ?? => ij +"\u0133" => "ij" + +# ?? => d +"\u00F0" => "d" + +# ?? => n +"\u00F1" => "n" + +# ?? => o +"\u00F2" => "o" + +# ?? => o +"\u00F3" => "o" + +# ?? => o +"\u00F4" => "o" + +# ?? => o +"\u00F5" => "o" + +# ?? => o +"\u00F6" => "o" + +# ?? => o +"\u00F8" => "o" + +# ?? => oe +"\u0153" => "oe" + +# ?? => ss +"\u00DF" => "ss" + +# ?? => th +"\u00FE" => "th" + +# ?? => u +"\u00F9" => "u" + +# ?? => u +"\u00FA" => "u" + +# ?? => u +"\u00FB" => "u" + +# ?? => u +"\u00FC" => "u" + +# ?? => y +"\u00FD" => "y" + +# ?? => y +"\u00FF" => "y" + +# ??? => ff +"\uFB00" => "ff" + +# ??? => fi +"\uFB01" => "fi" + +# ??? => fl +"\uFB02" => "fl" + +# ??? => ffi +"\uFB03" => "ffi" + +# ??? => ffl +"\uFB04" => "ffl" + +# ??? => ft +"\uFB05" => "ft" + +# ??? => st +"\uFB06" => "st" diff --git a/solr/config/protwords.txt b/solr/config/protwords.txt new file mode 100644 index 000000000..5a32e5032 --- /dev/null +++ b/solr/config/protwords.txt @@ -0,0 +1,21 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# Use a protected word file to protect against the stemmer reducing two +# unrelated words to the same base word. + +# Some non-words that normally won't be encountered, +# just to test that they won't be stemmed. +dontstems +zwhacky + diff --git a/solr/config/schema.xml b/solr/config/schema.xml new file mode 100644 index 000000000..9fa17a9d0 --- /dev/null +++ b/solr/config/schema.xml @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + + + + + + + + + + + + + + + + + + + + + diff --git a/solr/config/scripts.conf b/solr/config/scripts.conf new file mode 100644 index 000000000..f58b262ae --- /dev/null +++ b/solr/config/scripts.conf @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +user= +solr_hostname=localhost +solr_port=8983 +rsyncd_port=18983 +data_dir= +webapp_name=solr +master_host= +master_data_dir= +master_status_dir= diff --git a/solr/config/solrconfig.xml b/solr/config/solrconfig.xml new file mode 100644 index 000000000..0ab888004 --- /dev/null +++ b/solr/config/solrconfig.xml @@ -0,0 +1,419 @@ + + + + + + + + 5.0.0 + + + + + + + + + + + + + ${solr.blacklight-core.data.dir:} + + + + + + + + + + *:* + + + + + + + dismax + explicit + 10 + + *:* + 2<-1 5<-2 6<90% + + + + + title_unstem_search^100000 + subtitle_unstem_search^50000 + title_t^25000 + subtitle_t^10000 + title_addl_unstem_search^5000 + title_addl_t^2500 + title_added_entry_unstem_search^1500 + title_added_entry_t^1250 + subject_topic_unstem_search^1000 + subject_unstem_search^750 + subject_topic_facet^625 + subject_t^500 + author_unstem_search^250 + author_addl_unstem_search^250 + author_t^100 + author_addl_t^50 + subject_addl_unstem_search^250 + subject_addl_t^50 + title_series_unstem_search^25 + title_series_t^10 + isbn_t + text + + + title_unstem_search^1000000 + subtitle_unstem_search^500000 + title_t^250000 + subtitle_t^100000 + title_addl_unstem_search^50000 + title_addl_t^25000 + title_added_entry_unstem_search^15000 + title_added_entry_t^12500 + subject_topic_unstem_search^10000 + subject_unstem_search^7500 + subject_topic_facet^6250 + subject_t^5000 + author_unstem_search^2500 + author_addl_unstem_search^2500 + author_t^1000 + author_addl_t^500 + subject_addl_unstem_search^2500 + subject_addl_t^500 + title_series_unstem_search^250 + title_series_t^100 + text^10 + + + author_unstem_search^200 + author_addl_unstem_search^50 + author_t^20 + author_addl_t + + + author_unstem_search^2000 + author_addl_unstem_search^500 + author_t^200 + author_addl_t^10 + + + title_unstem_search^50000 + subtitle_unstem_search^25000 + title_addl_unstem_search^10000 + title_t^5000 + subtitle_t^2500 + title_addl_t^100 + title_added_entry_unstem_search^50 + title_added_entry_t^10 + title_series_unstem_search^5 + title_series_t + + + title_unstem_search^500000 + subtitle_unstem_search^250000 + title_addl_unstem_search^100000 + title_t^50000 + subtitle_t^25000 + title_addl_t^1000 + title_added_entry_unstem_search^500 + title_added_entry_t^100 + title_series_t^50 + title_series_unstem_search^10 + + + subject_topic_unstem_search^200 + subject_unstem_search^125 + subject_topic_facet^100 + subject_t^50 + subject_addl_unstem_search^10 + subject_addl_t + + + subject_topic_unstem_search^2000 + subject_unstem_search^1250 + subject_t^1000 + subject_topic_facet^500 + subject_addl_unstem_search^100 + subject_addl_t^10 + + + 3 + 0.01 + + + + id, + score, + author_display, + author_vern_display, + format, + isbn_t, + language_facet, + lc_callnum_display, + material_type_display, + published_display, + published_vern_display, + pub_date, + title_display, + title_vern_display, + subject_topic_facet, + subject_geo_facet, + subject_era_facet, + subtitle_display, + subtitle_vern_display, + url_fulltext_display, + url_suppl_display, + + + true + 1 + 10 + format + lc_1letter_facet + lc_alpha_facet + lc_b4cutter_facet + language_facet + pub_date + subject_era_facet + subject_geo_facet + subject_topic_facet + + true + default + true + true + false + 5 + + + + + + + + + + + spellcheck + + + + + + + explicit + lucene + + + + + + + all + * + 1 + {!term f=id v=$id} + + + + + + + textSpell + + + + + + default + spell + ./spell + true + + + author + author_spell + ./spell_author + 0.7 + true + + + subject + subject_spell + ./spell_subject + 0.7 + true + + + title + title_spell + ./spell_title + 0.7 + true + + + + + + + + + + + + + + + mySuggester + FuzzyLookupFactory + textSuggest + true + suggest + + + + + + true + 5 + mySuggester + + + suggest + + + + + diff --git a/solr/config/spellings.txt b/solr/config/spellings.txt new file mode 100644 index 000000000..765190ae5 --- /dev/null +++ b/solr/config/spellings.txt @@ -0,0 +1,2 @@ +pizza +history diff --git a/solr/config/stopwords.txt b/solr/config/stopwords.txt new file mode 100644 index 000000000..22f277fe0 --- /dev/null +++ b/solr/config/stopwords.txt @@ -0,0 +1,58 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# a couple of test stopwords to test that the words are really being +# configured from this file: +stopworda +stopwordb + +#Standard english stop words taken from Lucene's StopAnalyzer +a +an +and +are +as +at +be +but +by +for +if +in +into +is +it +no +not +of +on +or +s +such +t +that +the +their +then +there +these +they +this +to +was +will +with + diff --git a/solr/config/stopwords_en.txt b/solr/config/stopwords_en.txt new file mode 100644 index 000000000..22f277fe0 --- /dev/null +++ b/solr/config/stopwords_en.txt @@ -0,0 +1,58 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# a couple of test stopwords to test that the words are really being +# configured from this file: +stopworda +stopwordb + +#Standard english stop words taken from Lucene's StopAnalyzer +a +an +and +are +as +at +be +but +by +for +if +in +into +is +it +no +not +of +on +or +s +such +t +that +the +their +then +there +these +they +this +to +was +will +with + diff --git a/solr/config/synonyms.txt b/solr/config/synonyms.txt new file mode 100644 index 000000000..453eb3139 --- /dev/null +++ b/solr/config/synonyms.txt @@ -0,0 +1,31 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +#some test synonym mappings unlikely to appear in real input text +aaa => aaaa +bbb => bbbb1 bbbb2 +ccc => cccc1,cccc2 +a\=>a => b\=>b +a\,a => b\,b +fooaaa,baraaa,bazaaa + +# Some synonym groups specific to this example +GB,gib,gigabyte,gigabytes +MB,mib,megabyte,megabytes +Television, Televisions, TV, TVs +#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming +#after us won't split it into two words. + +# Synonym mappings can be used for spelling correction too +pixima => pixma + diff --git a/solr/config/xslt/example.xsl b/solr/config/xslt/example.xsl new file mode 100644 index 000000000..ff7cae746 --- /dev/null +++ b/solr/config/xslt/example.xsl @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + <xsl:value-of select="$title"/> + + + +

+
+ This has been formatted by the sample "example.xsl" transform - + use your own XSLT to get a nicer page +
+ + + +
+ + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + javascript:toggle("");? +
+ + exp + + + + + +
+ + +
+ + + + + + + +
    + +
  • +
    +
+ + +
+ + + + + + + + + + + + + + + + + + + + +
diff --git a/solr/config/xslt/example_atom.xsl b/solr/config/xslt/example_atom.xsl new file mode 100644 index 000000000..dbc7afa3b --- /dev/null +++ b/solr/config/xslt/example_atom.xsl @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + Example Solr Atom 1.0 Feed + + This has been formatted by the sample "example_atom.xsl" transform - + use your own XSLT to get a nicer Atom feed. + + + Apache Solr + solr-user@lucene.apache.org + + + + + + tag:localhost,2007:example + + + + + + + + + <xsl:value-of select="str[@name='name']"/> + + tag:localhost,2007: + + + + + + diff --git a/solr/config/xslt/example_rss.xsl b/solr/config/xslt/example_rss.xsl new file mode 100644 index 000000000..b5bd0cf9f --- /dev/null +++ b/solr/config/xslt/example_rss.xsl @@ -0,0 +1,66 @@ + + + + + + + + + + + + + Example Solr RSS 2.0 Feed + http://localhost:8983/solr + + This has been formatted by the sample "example_rss.xsl" transform - + use your own XSLT to get a nicer RSS feed. + + en-us + http://localhost:8983/solr + + + + + + + + + + + <xsl:value-of select="str[@name='name']"/> + + http://localhost:8983/solr/select?q=id: + + + + + + + http://localhost:8983/solr/select?q=id: + + + + diff --git a/solr/config/xslt/luke.xsl b/solr/config/xslt/luke.xsl new file mode 100644 index 000000000..d3f71c6d8 --- /dev/null +++ b/solr/config/xslt/luke.xsl @@ -0,0 +1,337 @@ + + + + + + + + + Solr Luke Request Handler Response + + + + + + + + + <xsl:value-of select="$title"/> + + + + + +

+ +

+
+ +
+ +

Index Statistics

+ +
+ +

Field Statistics

+ + + +

Document statistics

+ + + + +
+ + + + + +
+ +
+ + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+

+ +

+ +
+ +
+
+
+ + +
+ + 50 + 800 + 160 + blue + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ background-color: ; width: px; height: px; +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
  • + +
  • +
    +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + + + + + + + + + + + + + + + + +
diff --git a/spec/integration/complex_rdf_datastream_spec.rb b/spec/integration/complex_rdf_datastream_spec.rb index af4380029..34ecba766 100644 --- a/spec/integration/complex_rdf_datastream_spec.rb +++ b/spec/integration/complex_rdf_datastream_spec.rb @@ -17,7 +17,7 @@ class Component < ActiveTriples::Resource end let(:ds) do - SpecDatastream.new('http://localhost:8983/fedora/rest/test/test:124/descMd') + SpecDatastream.new("#{ActiveFedora.fedora.host}/test/test:124/descMd") end describe "#new_record?" do @@ -27,8 +27,8 @@ class Component < ActiveTriples::Resource end it "does not be new when it's loaded from fedora" do - ds.content = '_:g70324142325120 "Alternator" . - _:g70324142325120 .' + ds.content = "_:g70324142325120 \"Alternator\" . +<#{ActiveFedora.fedora.host}/test/test:124> _:g70324142325120 ." ds.resource.persist! expect(ds.parts.first).to_not be_new_record end @@ -81,8 +81,8 @@ class Component < ActiveTriples::Resource it "loads complex objects" do ds.content = < "Alternator" . - _:g70350851837440 . - _:g70350851833380 . +<#{ActiveFedora.fedora.host}/test/test:124> _:g70350851837440 . +<#{ActiveFedora.fedora.host}/test/test:124> _:g70350851833380 . _:g70350851833380 "Crankshaft" . END expect(ds.parts.first.label).to eq ["Alternator"] @@ -140,7 +140,7 @@ class MediatorUser < ActiveTriples::Resource after(:each) do Object.send(:remove_const, :SpecDatastream) end - let(:ds) { SpecDatastream.new('http://localhost:8983/fedora/rest/test/test:124/descMd') } + let(:ds) { SpecDatastream.new("#{ActiveFedora.fedora.host}/test/test:124/descMd") } it "stores the type of complex objects when type is specified" do comp = SpecDatastream::MediatorUser.new nil, ds.graph @@ -154,7 +154,7 @@ class MediatorUser < ActiveTriples::Resource it "adds the type of complex object when it is not provided" do ds.content = < "Mediation Person" . - _:g70350851837440 . + <#{ActiveFedora.fedora.host}/test/test:124> _:g70350851837440 . END expect(ds.mediator.first.type.first.to_s).to eq "http://purl.org/dc/terms/AgentClass" end @@ -163,7 +163,7 @@ class MediatorUser < ActiveTriples::Resource ds.content = < "Mediation Orgainzation" . _:g70350851837440 . - _:g70350851837440 . + <#{ActiveFedora.fedora.host}/test/test:124> _:g70350851837440 . END expect(ds.mediator.first.type.first.to_s).to eq "http://www.ebu.ch/metadata/ontologies/ebucore#Organisation" end diff --git a/spec/integration/ntriples_datastream_spec.rb b/spec/integration/ntriples_datastream_spec.rb index 77bfb16e2..97bc87791 100644 --- a/spec/integration/ntriples_datastream_spec.rb +++ b/spec/integration/ntriples_datastream_spec.rb @@ -49,12 +49,23 @@ class RdfTest < ActiveFedora::Base @subject.save end + let(:remote_content) do + < "2010-12-31"^^ . +<#{ActiveFedora.fedora.host}/test/test:1> "Title of work" . +<#{ActiveFedora.fedora.host}/test/test:1> "Penn State" . +<#{ActiveFedora.fedora.host}/test/test:1> "New York, NY, US" . +<#{ActiveFedora.fedora.host}/test/test:1> . +<#{ActiveFedora.fedora.host}/test/test:1/content> "Title of datastream" . +EOF + end + it "saves content properly upon save" do foo = RdfTest.new('test:1') # ID needs to match the subject in the loaded file foo.title = 'Hamlet' foo.save expect(foo.title).to eq 'Hamlet' - foo.rdf.content = File.new('spec/fixtures/mixed_rdf_descMetadata.nt').read + foo.rdf.content = remote_content foo.save expect(foo.title).to eq 'Title of work' end diff --git a/spec/unit/base_spec.rb b/spec/unit/base_spec.rb index 66b8064af..c0eb43c64 100644 --- a/spec/unit/base_spec.rb +++ b/spec/unit/base_spec.rb @@ -204,7 +204,7 @@ def increment_id context "when its saved" do before do allow(@test_object).to receive(:new_record?).and_return(false) - allow(@test_object).to receive(:uri).and_return('http://localhost:8983/fedora/rest/test/one/two/three') + allow(@test_object).to receive(:uri).and_return("#{ActiveFedora.fedora.host}/test/one/two/three") end context "#to_param" do diff --git a/spec/unit/ntriples_datastream_spec.rb b/spec/unit/ntriples_datastream_spec.rb index 5adbdeb70..420d036dd 100644 --- a/spec/unit/ntriples_datastream_spec.rb +++ b/spec/unit/ntriples_datastream_spec.rb @@ -1,6 +1,17 @@ require 'spec_helper' describe ActiveFedora::NtriplesRDFDatastream do + let(:remote_content) do + < "2010-12-31"^^ . +<#{ActiveFedora.fedora.host}/test/test:1> "Title of work" . +<#{ActiveFedora.fedora.host}/test/test:1> "Penn State" . +<#{ActiveFedora.fedora.host}/test/test:1> "New York, NY, US" . +<#{ActiveFedora.fedora.host}/test/test:1> . +<#{ActiveFedora.fedora.host}/test/test:1/content> "Title of datastream" . +EOF + end + describe "an instance with content" do before do class MyDatastream < ActiveFedora::NtriplesRDFDatastream @@ -13,13 +24,13 @@ class MyDatastream < ActiveFedora::NtriplesRDFDatastream property :related_url, predicate: ::RDF::RDFS.seeAlso end @subject = MyDatastream.new(ActiveFedora::Base.id_to_uri('/test:1/descMetadata')) - @subject.content = File.new('spec/fixtures/mixed_rdf_descMetadata.nt').read + @subject.content = remote_content end after do Object.send(:remove_const, :MyDatastream) end it "has a subject" do - expect(@subject.rdf_subject).to eq "http://localhost:8983/fedora/rest/test/test:1" + expect(@subject.rdf_subject).to eq "#{ActiveFedora.fedora.host}/test/test:1" end it "has mime_type" do expect(@subject.mime_type).to eq 'text/plain' @@ -83,7 +94,7 @@ class MyDatastream < ActiveFedora::NtriplesRDFDatastream describe "an instance with a custom subject" do before do class MyDatastream < ActiveFedora::NtriplesRDFDatastream - rdf_subject { |ds| "http://localhost:8983/fedora/rest/test/#{ds.id}/content" } + rdf_subject { |ds| "#{ActiveFedora.fedora.host}/test/#{ds.id}/content" } property :created, predicate: ::RDF::Vocab::DC.created property :title, predicate: ::RDF::Vocab::DC.title property :publisher, predicate: ::RDF::Vocab::DC.publisher @@ -96,10 +107,6 @@ class MyDatastream < ActiveFedora::NtriplesRDFDatastream allow(@subject).to receive(:remote_content).and_return remote_content end - let(:remote_content) do - File.new('spec/fixtures/mixed_rdf_descMetadata.nt').read - end - after do Object.send(:remove_const, :MyDatastream) end @@ -109,20 +116,22 @@ class MyDatastream < ActiveFedora::NtriplesRDFDatastream end it "has a custom subject" do - expect(@subject.rdf_subject).to eq 'http://localhost:8983/fedora/rest/test/test:1/content' + expect(@subject.rdf_subject).to eq "#{ActiveFedora.fedora.host}/test/test:1/content" end end describe "a new instance" do - before(:each) do + before do class MyDatastream < ActiveFedora::NtriplesRDFDatastream property :publisher, predicate: ::RDF::Vocab::DC.publisher end @subject = MyDatastream.new end - after(:each) do + + after do Object.send(:remove_const, :MyDatastream) end + it "supports to_s method" do expect(@subject.publisher.to_s).to eq [].to_s @subject.publisher = "Bob" @@ -183,6 +192,7 @@ class MyDatastream < ActiveFedora::NtriplesRDFDatastream doc = {} expect(@subject.to_solr(doc)).to eq doc end + describe "with an actual object" do before(:each) do class Foo < ActiveFedora::Base diff --git a/spec/unit/sparql_insert_spec.rb b/spec/unit/sparql_insert_spec.rb index 673a46afb..e171f020e 100644 --- a/spec/unit/sparql_insert_spec.rb +++ b/spec/unit/sparql_insert_spec.rb @@ -25,7 +25,7 @@ class Book < ActiveFedora::Base let(:base) { Book.create } it "returns the string" do - expect(subject.build).to eq "DELETE { <> ?change . }\n WHERE { <> ?change . } ;\nDELETE { <> ?change . }\n WHERE { <> ?change . } ;\nINSERT { \n<> .\n<> \"bar\" .\n}\n WHERE { }" + expect(subject.build).to eq "DELETE { <> ?change . }\n WHERE { <> ?change . } ;\nDELETE { <> ?change . }\n WHERE { <> ?change . } ;\nINSERT { \n<> <#{ActiveFedora.fedora.host}/test/foo> .\n<> \"bar\" .\n}\n WHERE { }" end end end