sunspot_with_activeuuid 0.0.2
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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +26 -0
- data/Rakefile +2 -0
- data/lib/sunspot_with_activeuuid/rails.rb +26 -0
- data/lib/sunspot_with_activeuuid/version.rb +3 -0
- data/lib/sunspot_with_activeuuid.rb +5 -0
- data/sunspot_with_activeuuid.gemspec +22 -0
- data/sunspot_with_activeuuid.sublime-project +8 -0
- data/sunspot_with_activeuuid.sublime-workspace +1413 -0
- metadata +104 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Daniel Blanco
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# SunspotWithActiveuuid
|
2
|
+
|
3
|
+
Extends sunspot to be compatible with activeuuid. Activeuuid gem uses UUID objects
|
4
|
+
as primary keys for models, what this gem does is making sure that sunspot is aware of it.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'sunspot_with_activeuuid'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install sunspot_with_activeuuid
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Fork it
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
24
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
26
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Sunspot
|
2
|
+
module Rails
|
3
|
+
module Adapters
|
4
|
+
class ActiveRecordDataAccessor < Sunspot::Adapters::DataAccessor
|
5
|
+
def load(id)
|
6
|
+
@clazz.first(options_for_find.merge(
|
7
|
+
:conditions => { @clazz.primary_key => id.to_uuid }
|
8
|
+
))
|
9
|
+
end
|
10
|
+
def load_all(ids)
|
11
|
+
@clazz.all(options_for_find.merge(
|
12
|
+
:conditions => { @clazz.primary_key => ids.map { |id| id.to_uuid }}
|
13
|
+
))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
module Searchable
|
18
|
+
module ClassMethods
|
19
|
+
def solr_execute_search_ids(options = {})
|
20
|
+
search = yield
|
21
|
+
search.raw_results.map { |raw_result| raw_result.primary_key.to_uuid }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/sunspot_with_activeuuid/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Daniel Blanco"]
|
6
|
+
gem.email = ["daniel.blancorojas@gmail.com"]
|
7
|
+
gem.description = %q{UUID ids for sunspot}
|
8
|
+
gem.summary = %q{Extends sunspot to be compatible with activeuuid}
|
9
|
+
gem.homepage = "https://github.com/DanielBlanco/sunspot_with_activeuuid"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "sunspot_with_activeuuid"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = SunspotWithActiveuuid::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency "rspec"
|
19
|
+
|
20
|
+
gem.add_dependency "activeuuid"
|
21
|
+
gem.add_dependency "uuid_helper"
|
22
|
+
end
|