Permalink
Browse files

removing unused code from previous version

  • Loading branch information...
1 parent 1d7de7d commit 8c037bf96a5b3ad779b815a82fcf4546521b22d6 @ryanb committed Apr 26, 2011
Showing with 65 additions and 2,801 deletions.
  1. +12 −12 Gemfile
  2. +0 −2 Rakefile
  3. +0 −1 init.rb
  4. +0 −8 install.rb
  5. +3 −70 lib/xapit.rb
  6. +0 −47 lib/xapit/client/adapters/abstract_adapter.rb
  7. +0 −20 lib/xapit/client/adapters/active_record_adapter.rb
  8. +0 −10 lib/xapit/client/adapters/data_mapper_adapter.rb
  9. +14 −189 lib/xapit/client/collection.rb
  10. +0 −67 lib/xapit/client/facet.rb
  11. +0 −141 lib/xapit/client/membership.rb
  12. +0 −13 lib/xapit/client/rake_tasks.rb
  13. +0 −79 lib/xapit/server/config.rb
  14. +32 −0 lib/xapit/server/database.rb
  15. +0 −37 lib/xapit/server/document.rb
  16. +0 −59 lib/xapit/server/facet_blueprint.rb
  17. +0 −56 lib/xapit/server/facet_option.rb
  18. +0 −137 lib/xapit/server/index_blueprint.rb
  19. +0 −121 lib/xapit/server/indexers/abstract_indexer.rb
  20. +0 −29 lib/xapit/server/indexers/classic_indexer.rb
  21. +0 −40 lib/xapit/server/indexers/simple_indexer.rb
  22. +0 −81 lib/xapit/server/local_database.rb
  23. +0 −89 lib/xapit/server/query.rb
  24. +0 −172 lib/xapit/server/query_parsers/abstract_query_parser.rb
  25. +0 −29 lib/xapit/server/query_parsers/classic_query_parser.rb
  26. +0 −75 lib/xapit/server/query_parsers/simple_query_parser.rb
  27. +0 −41 lib/xapit/server/server.rb
  28. +0 −13 rails_generators/xapit/USAGE
  29. +0 −1 rails_generators/xapit/templates/setup_xapit.rb
  30. +0 −4 rails_generators/xapit/templates/xapit.rake
  31. +0 −20 rails_generators/xapit/xapit_generator.rb
  32. +0 −34 spec/xapit/adapters/active_record_adapter_spec.rb
  33. +0 −13 spec/xapit/adapters/data_mapper_adapter_spec.rb
  34. +4 −2 spec/xapit/client/collection_spec.rb
  35. +0 −177 spec/xapit/collection_spec.rb
  36. +0 −62 spec/xapit/config_spec.rb
  37. +0 −30 spec/xapit/facet_blueprint_spec.rb
  38. +0 −81 spec/xapit/facet_option_spec.rb
  39. +0 −74 spec/xapit/facet_spec.rb
  40. +0 −99 spec/xapit/index_blueprint_spec.rb
  41. +0 −111 spec/xapit/indexers/abstract_indexer_spec.rb
  42. +0 −37 spec/xapit/indexers/classic_indexer_spec.rb
  43. +0 −61 spec/xapit/indexers/simple_indexer_spec.rb
  44. +0 −5 spec/xapit/local_database_spec.rb
  45. +0 −61 spec/xapit/membership_spec.rb
  46. +0 −68 spec/xapit/query_parsers/abstract_query_parser_spec.rb
  47. +0 −25 spec/xapit/query_parsers/classic_query_parser_spec.rb
  48. +0 −87 spec/xapit/query_parsers/simple_query_parser_spec.rb
  49. +0 −61 spec/xapit/query_spec.rb
  50. +0 −44 spec/xapit/server_spec.rb
  51. +0 −5 uninstall.rb
  52. +0 −1 xapit.gemspec
View
24 Gemfile
@@ -1,16 +1,16 @@
source "http://rubygems.org"
-case ENV["MODEL_ADAPTER"]
-when nil, "active_record"
- gem "sqlite3"
- gem "activerecord", :require => "active_record"
- gem "with_model"
-when "data_mapper"
- gem "dm-core", "~> 1.0.2"
- gem "dm-sqlite-adapter", "~> 1.0.2"
- gem "dm-migrations", "~> 1.0.2"
-else
- raise "Unknown model adapter: #{ENV["MODEL_ADAPTER"]}"
-end
+# case ENV["MODEL_ADAPTER"]
+# when nil, "active_record"
+# gem "sqlite3"
+# gem "activerecord", :require => "active_record"
+# gem "with_model"
+# when "data_mapper"
+# gem "dm-core", "~> 1.0.2"
+# gem "dm-sqlite-adapter", "~> 1.0.2"
+# gem "dm-migrations", "~> 1.0.2"
+# else
+# raise "Unknown model adapter: #{ENV["MODEL_ADAPTER"]}"
+# end
gemspec
View
@@ -3,8 +3,6 @@ require 'rake'
require 'cucumber/rake/task'
require 'rspec/core/rake_task'
-require File.expand_path('../lib/xapit/client/rake_tasks', __FILE__)
-
desc "Run RSpec"
RSpec::Core::RakeTask.new do |t|
t.verbose = false
View
@@ -1 +0,0 @@
-require 'xapit'
View
@@ -1,8 +0,0 @@
-require 'ftools'
-
-source = File.join(File.dirname(__FILE__), '/rails_generators/xapit/templates/setup_xapit.rb')
-destination = "#{Rails.root}/config/initializers/setup_xapit.rb"
-unless File.exist? destination
- puts "Adding config/initializers/setup_xapit.rb"
- File.copy(source, destination)
-end
View
@@ -1,89 +1,22 @@
-require 'digest/sha1'
-require 'rubygems'
require 'xapian'
-# Looking for more documentation? A good place to start is Xapit::Membership
module Xapit
class << self
attr_accessor :database
def reset
@database = nil
end
- end
-
- # Index all membership classes with xapit defined. Delegates to Xapit::IndexBlueprint.
- # You will likely want to call Xapit.remove_database before this.
- def self.index_all(*args, &block)
- IndexBlueprint.index_all(*args, &block)
- end
- # Used to perform a search on all indexed models. The returned collection can
- # contain instances of different classes which were indexed.
- #
- # # perform a simple full text search
- # @records = Xapit.search("phone")
- #
- # See Xapit::Membership for details on search options.
- def self.search(*args)
- Collection.new(nil, *args)
- end
-
- # Setup configuration options. The following options are supported.
- #
- # <tt>:database_path</tt>: Where the database is stored.
- # <tt>:stemming</tt>: The language to use for stemming, defaults to "english".
- # <tt>:spelling</tt>: True or false to enable/disable spelling, defaults to true.
- # <tt>:indexer</tt>: Class to handle the indexing, defaults to SimpleIndexer.
- # <tt>:query_parser</tt>: Class to handle the parsing, defaults to ClassicQueryParser.
- # <tt>:breadcrumb_facets</tt>: Use breadcrumb mode for applied facets. See Collection#applied_facet_options for details.
- #
- def self.setup(*args)
- Config.setup(*args)
- end
-
- # Removes the configured database file and clears the stored one in memory.
- def self.remove_database
- Config.remove_database
- end
-
- def self.serialize_value(value)
- if value.kind_of?(Date)
- Xapian.sortable_serialise(value.to_time.to_i)
- elsif value.kind_of?(Time)
- Xapian.sortable_serialise(value.to_i)
- elsif value.kind_of?(Numeric) || value.to_s =~ /^[0-9]+$/
- Xapian.sortable_serialise(value.to_f)
- else
- value.to_s.downcase
+ def value_index(*args)
+ Zlib.crc32(["xapit", *args].join) % 99999999 # TODO: Figure out the true max of a xapian value index
end
end
-
- # The Xapian value index position of an attribute
- def self.value_index(*args)
- Zlib.crc32(["xapit", *args].join) % 99999999 # Figure out the true max of a xapian value index
- end
end
require 'xapit/client/membership'
require 'xapit/client/index_builder'
require 'xapit/client/collection'
-require 'xapit/client/facet'
-require 'xapit/client/adapters/abstract_adapter'
-require 'xapit/client/adapters/active_record_adapter'
-require 'xapit/client/adapters/data_mapper_adapter'
-require 'xapit/server/index_blueprint'
-require 'xapit/server/config'
-require 'xapit/server/server'
-require 'xapit/server/facet_blueprint'
-require 'xapit/server/facet_option'
-require 'xapit/server/local_database'
-require 'xapit/server/document'
+require 'xapit/server/database'
require 'xapit/server/query'
-require 'xapit/server/query_parsers/abstract_query_parser'
-require 'xapit/server/query_parsers/simple_query_parser'
-require 'xapit/server/query_parsers/classic_query_parser'
-require 'xapit/server/indexers/abstract_indexer'
-require 'xapit/server/indexers/simple_indexer'
-require 'xapit/server/indexers/classic_indexer'
require 'xapit/server/indexer'
@@ -1,47 +0,0 @@
-module Xapit
- # Adapters are used to support multiple ORMs (ActiveRecord, Datamapper, Sequel, etc.).
- # It abstracts out all find calls so they can be handled differently for each ORM.
- # To create your own adapter, subclass AbstractAdapter and override the placeholder methods.
- # See ActiveRecordAdapter for an example.
- class AbstractAdapter
- def self.inherited(subclass)
- @subclasses ||= []
- @subclasses << subclass
- end
-
- # Returns all adapter classes.
- def self.subclasses
- @subclasses
- end
-
- # Sets the @target instance, this is the class the adapter needs to forward
- # its messages to.
- def initialize(target)
- @target = target
- end
-
- # Used to determine if the given adapter should be used for the passed in class.
- # Usually one will see if it inherits from another class (ActiveRecord::Base)
- def self.for_class?(member_class)
- raise "To be implemented in subclass"
- end
-
- # Fetch a single record by the given id.
- # The args are the same as those passed from the XapitMember#xapit call.
- def find_single(id, *args)
- raise "To be implemented in subclass"
- end
-
- # Fetch multiple records from the passed in array of ids.
- def find_multiple(ids)
- raise "To be implemented in subclass"
- end
-
- # Iiterate through all records using the given parameters.
- # It should yield to the block and pass in each record individually.
- # The args are the same as those passed from the XapitMember#xapit call.
- def find_each(*args, &block)
- raise "To be implemented in subclass"
- end
- end
-end
@@ -1,20 +0,0 @@
-module Xapit
- # This adapter is used for all ActiveRecord models. See AbstractAdapter for details.
- class ActiveRecordAdapter < AbstractAdapter
- def self.for_class?(member_class)
- member_class.ancestors.map(&:to_s).include? "ActiveRecord::Base"
- end
-
- def find_single(id, *args)
- @target.find_by_id(id, *args)
- end
-
- def find_multiple(ids)
- @target.find(ids)
- end
-
- def find_each(*args, &block)
- @target.find_each(*args, &block)
- end
- end
-end
@@ -1,10 +0,0 @@
-module Xapit
- # This adapter is used for all DataMapper models. See AbstractAdapter for details.
- class DataMapperAdapter < AbstractAdapter
- def self.for_class?(member_class)
- member_class.ancestors.map(&:to_s).include? "DataMapper::Resource"
- end
-
- # TODO override the rest of the methods here...
- end
-end
Oops, something went wrong.

0 comments on commit 8c037bf

Please sign in to comment.