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
// There's probably a more concise solution, but I prefer clarity over conciseness | |
// Splits on any number of non-word characters. | |
// Apostrophes don't cause case-change. | |
function toCamelCase(str) { | |
if (str==null || str==undefined || str.length==0) return str; | |
str = str.replace(/'/g, ""); | |
var arr = str.split(/[^\w]+/g); // split on any sequence of one or more | |
// non-word chars. | |
var ret = ""; | |
// Look for the first non-zero-length String. |
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
public! |
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
git-rm --cached log/development.log |
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
config.gem 'sunspot', :lib => 'sunspot' | |
config.gem 'sunspot_rails', :lib => 'sunspot/rails' |
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
common: &common | |
solr: | |
hostname: localhost | |
port: 8983 | |
production: | |
<<: *common | |
development: | |
<<: *common |
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
searchable do | |
text :xml, :boost => 2.0 | |
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
[kieran@localhost myapp]$ script/console | |
Loading development environment (Rails 2.3.2) | |
>> c = Content.new(:xml => '<content><field1>abc</field1><field2>def</field2></content>') | |
>> c.save | |
=> true | |
>> Content.search.results | |
=> [] | |
>> Sunspot.commit | |
=> {"responseHeader"=>{"status"=>0, "QTime"=>33}} | |
=> Content.search.results |
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
query.adjust_solr_params do |params| | |
params[:"f.#{Sunspot::Setup.for(MyModel).dynamic_field_factory(:custom).build(:my_field).indexed_name}.facet.prefix"] = my_leading_str | |
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
test "sunspot available" do | |
begin | |
# Search for instances of "String". The String class will always | |
# exist, so I use it in order to make this test simpler. It then | |
# has no dependency on my application classes. | |
s = Sunspot.search(String) {} | |
rescue | |
assert false, "Cannot connect to solr server #{Sunspot.config.solr.url}\n#{$!}" | |
end | |
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
[kieran@localhost myapp]$ # Build docs | |
[kieran@localhost myapp]$ rake doc:app | |
[kieran@localhost myapp]$ # The following line shows you where to browse to | |
[kieran@localhost myapp]$ # in order to view your docs | |
[kieran@localhost myapp]$ echo "Find your docs here: file:///$PWD/doc/app/index.html" |
OlderNewer