-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add plugins for signal wiki, edit can_flag to be polymorphic
- Loading branch information
Jeremy McAnally
committed
May 5, 2008
1 parent
99aa8e6
commit 38a8fcd
Showing
144 changed files
with
8,768 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
===0.4.3 [27 September 2007] | ||
- Fixed a bug causing records to be deleted from index during record updates. | ||
|
||
===0.4.2 [27 September 2007] | ||
- Fixed a bug causing identically ranked records to be lost. | ||
|
||
===0.4.1 [22 September 2007] | ||
- Fixed a bug in the main search method. | ||
|
||
===0.4.0 [22 September 2007] | ||
- Search results now ranked by relevance. | ||
|
||
===0.3.3 [20 September 2007] | ||
- Fixed index update bug where deleted atoms were not removed from index. | ||
- Improved performance of quoted queries. | ||
- Improved performance of index updates. | ||
- When building a full index, records are retrieved and indexed in batches to reduce memory consumption. | ||
|
||
===0.3.2 [19 September 2007] | ||
- Fixed index update bug. | ||
|
||
===0.3.1 [18 September 2007] | ||
- Added RDoc documentation comments. | ||
|
||
===0.3.0 [18 September 2007] | ||
- Minor bug fixes. | ||
- min_word_size now works properly, with quieries containing small words in | ||
quotes or being preceded by a '+' symbol are now searched on. | ||
|
||
===0.2.2 [06 September 2007] | ||
- Search now caches query results within a session. Call the search twice in an | ||
action? Only runs once! | ||
|
||
===0.2.1 [05 September 2007] | ||
- AR find options can now be passed to the search to allow finer control of | ||
returned Model Objects. | ||
|
||
===0.2.0 [04 September 2007] | ||
- Major performance improvements. | ||
- Index segmentation can now be tuned. | ||
|
||
===0.1.1 [31 August 2007] | ||
- Added a full set of tests. | ||
- Fixed various set-manipulation based errors. | ||
- Fixed a bug when searching for quoted phrases. | ||
|
||
===0.1.01 [31 August 2007] | ||
|
||
- Fixed a casting bug occurring when adding non-string fields to the index. | ||
|
||
===0.1 [31 August 2007] | ||
|
||
- Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2007 Douglas Shearer | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
= acts_as_indexed | ||
|
||
If you find this plugin useful, please consider a donation to show your support! | ||
|
||
http://www.paypal.com/cgi-bin/webscr?cmd=_send-money | ||
|
||
Paypal address: mailto:dougal.s@gmail.com | ||
|
||
|
||
== Instructions | ||
|
||
This plugin allows boolean-queried fulltext search to be added to any Rails app | ||
with no dependencies and minimal setup. | ||
|
||
|
||
== Resources | ||
|
||
=== Install | ||
./script/plugin install svn://svn.douglasfshearer.com/rails/plugins/acts_as_indexed | ||
|
||
|
||
== Usage | ||
|
||
|
||
=== Setup | ||
|
||
Add +acts_as_indexed+ to the top of any models you want to index, along with a | ||
list of the fields you wish to be indexed. | ||
|
||
class Post < ActiveRecord::Base | ||
acts_as_indexed :fields => [:title, :body] | ||
|
||
... | ||
end | ||
|
||
The fields are not limited to model fields, but can be any instance method of | ||
the current model. | ||
|
||
class User < ActiveRecord::Base | ||
acts_as_indexed :fields => [:address, :fullname] | ||
|
||
def fullname | ||
return self.firstname + ' ' + self.lastname | ||
end | ||
|
||
... | ||
end | ||
|
||
Acts_as_indexed automatically filters out query words shorter than 3 characters, for | ||
performance sake. This value can be changed by passing +min_word_size+ along | ||
with the fields. NOTE: The index files must be rebuilt by deleting the 'index' | ||
directory in your app's root directory. | ||
|
||
class Post < ActiveRecord::Base | ||
acts_as_indexed :fields => [:title, :body], :min_word_size => 5 | ||
|
||
... | ||
end | ||
|
||
|
||
=== Searching | ||
|
||
To search, call the +find_with_index+ method on your model, passing a query as | ||
the first argument. The optional +ids_only+ parameter, when set to true, will | ||
return only the IDs of any matching records. | ||
|
||
# Returns array of Post objects. | ||
my_search_results = Post.find_with_index('my search query') # => [#<Post:0x314b09c @attributes={"... | ||
|
||
# Pass any of the ActiveRecord find options to the search. | ||
my_search_results = Post.find_with_index('my search query',{:limit => 10}) # return the first 10 matches. | ||
|
||
# Returns array of IDs. | ||
my_search_results = Post.find_with_index('my search query',{},{:ids_only => true}) # => [12,19,33... | ||
|
||
|
||
=== Query Options | ||
|
||
The following query operators are supported: | ||
|
||
AND:: This is the default option. 'cat dog' will find records matching 'cat' AND 'dog'. | ||
NOT:: 'cat -dog' will find records matching 'cat' AND NOT 'dog' | ||
INCLUDE:: 'cat +me' will find records matching 'cat' and 'me', even if 'me' is smaller than the +min_word_size+ | ||
"":: Quoted terms are matched as phrases. '"cat dog"' will find records matching the whole phrase. Quoted terms can be preceded by the NOT operator; 'cat -"big dog"' etc. Quoted terms can include words shorter than the +min_word_size+. | ||
|
||
== RDoc Documentation | ||
|
||
To generate the RDoc documentation, run the <tt>rake rdoc</tt> task in the acts_as_indexed | ||
plugin folder. Then point your browser at <tt>/vendor/plugins/acts_as_indexed/rdoc/index.html</tt>. | ||
|
||
Alternatively, you can view the rdoc documentation online[http://douglasfshearer.com/rdoc/acts_as_indexed/]. | ||
|
||
== Problems, Comments, Suggestions? | ||
|
||
All of the above are most welcome. mailto:dougal.s@gmail.com | ||
|
||
|
||
== Credits | ||
|
||
Douglas F Shearer - http:douglasfshearer.com | ||
|
||
|
||
== Future Releases | ||
|
||
Future releases will be looking to add the following features: | ||
* Optional html scrubbing during indexing. | ||
* Ranked results based on query term occurences. | ||
* Ranking affected by field weightings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
desc 'Default: run unit tests.' | ||
task :default => :test | ||
|
||
desc 'Test the acts_as_indexed plugin.' | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = true | ||
end | ||
|
||
desc 'Generate documentation for the acts_as_indexed plugin.' | ||
Rake::RDocTask.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'ActsAsIndexed' | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.rdoc_files.include('README') | ||
rdoc.rdoc_files.include('CHANGELOG') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'acts_as_indexed' |
Oops, something went wrong.