Permalink
Browse files

+ everything is now namespaced

  • Loading branch information...
1 parent a2bc035 commit d6dbbb41c1307e0daaa94cabb67f3fa333332b0f @floere committed Jul 25, 2011
Showing with 5,210 additions and 4,965 deletions.
  1. +0 −56 server/deprecated/solr.rb
  2. +20 −16 server/lib/picky.rb
  3. +103 −99 server/lib/picky/backend/base.rb
  4. +19 −15 server/lib/picky/backend/files.rb
  5. +32 −28 server/lib/picky/backend/redis.rb
  6. +75 −73 server/lib/picky/bundle.rb
  7. +60 −56 server/lib/picky/categories.rb
  8. +73 −69 server/lib/picky/categories_indexed.rb
  9. +12 −8 server/lib/picky/categories_indexing.rb
  10. +115 −111 server/lib/picky/category.rb
  11. +37 −33 server/lib/picky/category_indexed.rb
  12. +124 −120 server/lib/picky/category_indexing.rb
  13. +32 −26 server/lib/picky/character_substituters/west_european.rb
  14. +96 −92 server/lib/picky/cores.rb
  15. +120 −116 server/lib/picky/frontend_adapters/rack.rb
  16. +5 −3 server/lib/picky/generators/aliases.rb
  17. +11 −7 server/lib/picky/generators/base.rb
  18. +7 −3 server/lib/picky/generators/partial/default.rb
  19. +24 −20 server/lib/picky/generators/partial/none.rb
  20. +20 −16 server/lib/picky/generators/partial/strategy.rb
  21. +94 −90 server/lib/picky/generators/partial/substring.rb
  22. +11 −7 server/lib/picky/generators/partial_generator.rb
  23. +9 −5 server/lib/picky/generators/similarity/default.rb
  24. +20 −16 server/lib/picky/generators/similarity/double_metaphone.rb
  25. +20 −16 server/lib/picky/generators/similarity/metaphone.rb
  26. +23 −19 server/lib/picky/generators/similarity/none.rb
  27. +49 −45 server/lib/picky/generators/similarity/phonetic.rb
  28. +20 −16 server/lib/picky/generators/similarity/soundex.rb
  29. +10 −6 server/lib/picky/generators/similarity/strategy.rb
  30. +11 −7 server/lib/picky/generators/similarity_generator.rb
  31. +14 −10 server/lib/picky/generators/strategy.rb
  32. +9 −5 server/lib/picky/generators/weights/default.rb
  33. +30 −26 server/lib/picky/generators/weights/logarithmic.rb
  34. +10 −6 server/lib/picky/generators/weights/strategy.rb
  35. +11 −7 server/lib/picky/generators/weights_generator.rb
  36. +20 −16 server/lib/picky/helpers/measuring.rb
  37. +39 −35 server/lib/picky/indexed/bundle/base.rb
  38. +68 −64 server/lib/picky/indexed/bundle/memory.rb
  39. +73 −69 server/lib/picky/indexed/bundle/redis.rb
  40. +26 −22 server/lib/picky/indexed/wrappers/bundle/calculation.rb
  41. +30 −26 server/lib/picky/indexed/wrappers/bundle/location.rb
  42. +36 −32 server/lib/picky/indexed/wrappers/bundle/wrapper.rb
  43. +17 −13 server/lib/picky/indexed/wrappers/category/location.rb
  44. +46 −42 server/lib/picky/indexed/wrappers/exact_first.rb
  45. +26 −22 server/lib/picky/indexers/base.rb
  46. +62 −58 server/lib/picky/indexers/parallel.rb
  47. +41 −37 server/lib/picky/indexers/serial.rb
  48. +68 −64 server/lib/picky/indexes.rb
  49. +341 −337 server/lib/picky/indexes/base.rb
  50. +16 −12 server/lib/picky/indexes/base_indexed.rb
  51. +118 −114 server/lib/picky/indexes/base_indexing.rb
  52. +13 −9 server/lib/picky/indexes/memory.rb
  53. +13 −9 server/lib/picky/indexes/redis.rb
  54. +16 −12 server/lib/picky/indexes_indexed.rb
  55. +41 −37 server/lib/picky/indexes_indexing.rb
  56. +186 −182 server/lib/picky/indexing/bundle/base.rb
  57. +15 −11 server/lib/picky/indexing/bundle/memory.rb
  58. +15 −11 server/lib/picky/indexing/bundle/redis.rb
  59. +17 −13 server/lib/picky/indexing/wrappers/category/location.rb
  60. +161 −156 server/lib/picky/interfaces/live_parameters.rb
  61. +280 −276 server/lib/picky/loader.rb
  62. +20 −13 server/lib/picky/loggers/search.rb
  63. +7 −3 server/lib/picky/no_source_specified_exception.rb
  64. +6 −2 server/lib/picky/performant.rb
  65. +5 −1 server/lib/picky/query.rb
  66. +71 −67 server/lib/picky/query/allocation.rb
  67. +99 −94 server/lib/picky/query/allocations.rb
  68. +70 −66 server/lib/picky/query/combination.rb
  69. +56 −52 server/lib/picky/query/combinations/base.rb
  70. +36 −32 server/lib/picky/query/combinations/memory.rb
  71. +66 −62 server/lib/picky/query/combinations/redis.rb
  72. +173 −169 server/lib/picky/query/indexes.rb
  73. +30 −26 server/lib/picky/query/qualifier_category_mapper.rb
  74. +0 −60 server/lib/picky/query/solr.rb
  75. +168 −164 server/lib/picky/query/token.rb
  76. +85 −87 server/lib/picky/query/tokens.rb
  77. +46 −42 server/lib/picky/query/weights.rb
  78. +51 −47 server/lib/picky/rack/harakiri.rb
  79. +81 −75 server/lib/picky/results.rb
  80. +164 −160 server/lib/picky/search.rb
  81. +73 −69 server/lib/picky/sources/base.rb
  82. +60 −56 server/lib/picky/sources/couch.rb
  83. +67 −63 server/lib/picky/sources/csv.rb
  84. +139 −135 server/lib/picky/sources/db.rb
  85. +52 −48 server/lib/picky/sources/delicious.rb
  86. +67 −63 server/lib/picky/sources/mongo.rb
  87. +20 −16 server/lib/picky/sources/wrappers/base.rb
  88. +37 −33 server/lib/picky/sources/wrappers/location.rb
  89. +46 −43 server/lib/picky/statistics.rb
  90. +198 −195 server/lib/picky/tokenizers/base.rb
  91. +25 −21 server/lib/picky/tokenizers/index.rb
  92. +33 −29 server/lib/picky/tokenizers/location.rb
  93. +49 −45 server/lib/picky/tokenizers/query.rb
View
@@ -1,56 +0,0 @@
-# encoding: utf-8
-#
-require 'rsolr'
-
-module Indexers
-
- # Deprecated. Only here as an example.
- #
- class Solr # :nodoc:
-
- attr_reader :type, :fields, :solr
-
- # Takes a Configuration::Type.
- #
- def initialize type
- @type = type
- @fields = type.solr_fields.map(&:name).map(&:to_sym)
- @solr = RSolr.connect
- end
-
- def index
- timed_exclaim "Indexing solr for #{type.name}:#{fields.join(', ')}"
- statement = "SELECT indexed_id, #{fields.join(',')} FROM #{type.snapshot_table_name}"
-
- DB.connect
- results = DB.connection.execute statement
-
- return unless results
-
- type_name = @type.name.to_s
-
- solr.delete_by_query "type:#{type_name}"
- solr.commit
-
- documents = []
-
- results.each do |indexed_id, *values|
- values.each &:downcase!
- documents << hashed(values).merge(id: indexed_id, type: type_name)
- end
-
- solr.add documents
- solr.commit
- solr.optimize
- end
-
- def hashed values
- result = {}
- fields.zip(values).each do |field, value|
- result[field] = value
- end
- result
- end
-
- end
-end
View
@@ -1,20 +1,24 @@
-# Require the constants.
-#
-require File.expand_path '../picky/constants', __FILE__
+module Picky
-# Library bundling.
-#
-require File.expand_path '../picky/bundling', __FILE__
+ # Require the constants.
+ #
+ require ::File.expand_path '../picky/constants', __FILE__
-# Loader which handles framework and app loading.
-#
-require File.expand_path '../picky/loader', __FILE__
+ # Library bundling.
+ #
+ require ::File.expand_path '../picky/bundling', __FILE__
-# Load the framework
-#
-Loader.load_framework
-puts "Loaded picky with environment '#{PICKY_ENVIRONMENT}' in #{PICKY_ROOT} on Ruby #{RUBY_VERSION}."
+ # Loader which handles framework and app loading.
+ #
+ require ::File.expand_path '../picky/loader', __FILE__
-# Check if delegators need to be installed.
-#
-require File.expand_path '../picky/sinatra', __FILE__
+ # Load the framework
+ #
+ Loader.load_framework
+ puts "Loaded picky with environment '#{PICKY_ENVIRONMENT}' in #{PICKY_ROOT} on Ruby #{RUBY_VERSION}."
+
+ # Check if delegators need to be installed.
+ #
+ require ::File.expand_path '../picky/sinatra', __FILE__
+
+end
@@ -1,115 +1,119 @@
-module Backend
+module Picky
- class Base
+ module Backend
- attr_reader :bundle,
- :inverted,
- :weights,
- :similarity,
- :configuration
+ class Base
- delegate :identifier,
- :to => :bundle
+ attr_reader :bundle,
+ :inverted,
+ :weights,
+ :similarity,
+ :configuration
- def initialize bundle
- @bundle = bundle
- end
- def identifier
- bundle.identifier
- end
+ delegate :identifier,
+ :to => :bundle
- # Delegators.
- #
+ def initialize bundle
+ @bundle = bundle
+ end
+ def identifier
+ bundle.identifier
+ end
- # Dumping.
- #
- def dump_inverted inverted_hash
- timed_exclaim %Q{"#{identifier}": => #{inverted}.}
- inverted.dump inverted_hash
- end
- def dump_weights weights_hash
- timed_exclaim %Q{"#{identifier}": => #{weights}.}
- weights.dump weights_hash
- end
- def dump_similarity similarity_hash
- timed_exclaim %Q{"#{identifier}": => #{similarity}.}
- similarity.dump similarity_hash
- end
- def dump_configuration configuration_hash
- timed_exclaim %Q{"#{identifier}": => #{configuration}.}
- configuration.dump configuration_hash
- end
+ # Delegators.
+ #
- # Loading.
- #
- def load_inverted
- inverted.load
- end
- def load_similarity
- similarity.load
- end
- def load_weights
- weights.load
- end
- def load_configuration
- configuration.load
- end
+ # Dumping.
+ #
+ def dump_inverted inverted_hash
+ timed_exclaim %Q{"#{identifier}": => #{inverted}.}
+ inverted.dump inverted_hash
+ end
+ def dump_weights weights_hash
+ timed_exclaim %Q{"#{identifier}": => #{weights}.}
+ weights.dump weights_hash
+ end
+ def dump_similarity similarity_hash
+ timed_exclaim %Q{"#{identifier}": => #{similarity}.}
+ similarity.dump similarity_hash
+ end
+ def dump_configuration configuration_hash
+ timed_exclaim %Q{"#{identifier}": => #{configuration}.}
+ configuration.dump configuration_hash
+ end
- # Cache ok?
- #
- def inverted_cache_ok?
- inverted.cache_ok?
- end
- def similarity_cache_ok?
- similarity.cache_ok?
- end
- def weights_cache_ok?
- weights.cache_ok?
- end
+ # Loading.
+ #
+ def load_inverted
+ inverted.load
+ end
+ def load_similarity
+ similarity.load
+ end
+ def load_weights
+ weights.load
+ end
+ def load_configuration
+ configuration.load
+ end
- # Cache small?
- #
- def inverted_cache_small?
- inverted.cache_small?
- end
- def similarity_cache_small?
- similarity.cache_small?
- end
- def weights_cache_small?
- weights.cache_small?
- end
+ # Cache ok?
+ #
+ def inverted_cache_ok?
+ inverted.cache_ok?
+ end
+ def similarity_cache_ok?
+ similarity.cache_ok?
+ end
+ def weights_cache_ok?
+ weights.cache_ok?
+ end
- # Copies the indexes to the "backup" directory.
- #
- def backup
- inverted.backup
- weights.backup
- similarity.backup
- configuration.backup
- end
+ # Cache small?
+ #
+ def inverted_cache_small?
+ inverted.cache_small?
+ end
+ def similarity_cache_small?
+ similarity.cache_small?
+ end
+ def weights_cache_small?
+ weights.cache_small?
+ end
- # Restores the indexes from the "backup" directory.
- #
- def restore
- inverted.restore
- weights.restore
- similarity.restore
- configuration.restore
- end
+ # Copies the indexes to the "backup" directory.
+ #
+ def backup
+ inverted.backup
+ weights.backup
+ similarity.backup
+ configuration.backup
+ end
- # Delete all index files.
- #
- def delete
- inverted.delete
- weights.delete
- similarity.delete
- configuration.delete
- end
+ # Restores the indexes from the "backup" directory.
+ #
+ def restore
+ inverted.restore
+ weights.restore
+ similarity.restore
+ configuration.restore
+ end
+
+ # Delete all index files.
+ #
+ def delete
+ inverted.delete
+ weights.delete
+ similarity.delete
+ configuration.delete
+ end
+
+ #
+ #
+ def to_s
+ "#{self.class}(#{bundle.identifier})"
+ end
- #
- #
- def to_s
- "#{self.class}(#{bundle.identifier})"
end
end
@@ -1,22 +1,26 @@
-module Backend
+module Picky
- class Files < Base
+ module Backend
- def initialize bundle
- super bundle
+ class Files < Base
- # Note: We marshal the similarity, as the
- # Yajl json lib cannot load symbolized
- # values, just keys.
- #
- @inverted = File::JSON.new bundle.index_path(:inverted)
- @weights = File::JSON.new bundle.index_path(:weights)
- @similarity = File::Marshal.new bundle.index_path(:similarity)
- @configuration = File::JSON.new bundle.index_path(:configuration)
- end
+ def initialize bundle
+ super bundle
+
+ # Note: We marshal the similarity, as the
+ # Yajl json lib cannot load symbolized
+ # values, just keys.
+ #
+ @inverted = File::JSON.new bundle.index_path(:inverted)
+ @weights = File::JSON.new bundle.index_path(:weights)
+ @similarity = File::Marshal.new bundle.index_path(:similarity)
+ @configuration = File::JSON.new bundle.index_path(:configuration)
+ end
+
+ def to_s
+ "#{self.class}(#{[@inverted, @weights, @similarity, @configuration].join(', ')})"
+ end
- def to_s
- "#{self.class}(#{[@inverted, @weights, @similarity, @configuration].join(', ')})"
end
end
Oops, something went wrong.

0 comments on commit d6dbbb4

Please sign in to comment.