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
/** | |
* -------------------------------------------------------------------- | |
* jQuery collapsible plugin | |
* Author: Scott Jehl, scott@filamentgroup.com | |
* Copyright (c) 2009 Filament Group | |
* licensed under MIT (filamentgroup.com/examples/mit-license.txt) | |
* -------------------------------------------------------------------- | |
* | |
* See: http://dwpe.googlecode.com | |
* http://filamentgroup.com/lab/expand_and_collapse_content_accessibly_with_progressive_enhancement_jquery/ |
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
require_dependency 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb' | |
class CatalogController < ApplicationController | |
# prepend_before_filter :transform_syntax | |
def solr_search_params(extra_controller_params={}) | |
solr_parameters = super extra_controller_params | |
my_parameters = solr_parameters.clone | |
if my_parameters.key? :q |
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
["foo", | |
"foo bar", | |
" foo bar ", | |
" foo bar baz ", | |
"+foo", | |
"-foo", | |
"+foo -bar", | |
"one +two three -four five", | |
"foo AND bar", | |
"one AND two AND three AND four", |
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
# 1. Get rid of ambiguity in parameters, you pass in user_parameters, from the BL rails app. No | |
# need to pass in direct solr parameters, the caller can add them on themselves, eg: | |
# i_want_to_force = {:rows => "10000"} | |
# solr_search_params(params).merge(i_want_to_force) | |
# | |
# 2. Try to make it as easy as possible to add units of logic and remove/replace units of logic | |
# -- we do that a lot. This may may be 'too clever', but the analogy is before_filter on | |
# controller, remember "before_filter :method_name", this is a similar thing for mapping logic. | |
def self.solr_search_params_logic |
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
module Foo | |
def print_something | |
"foo" | |
end | |
end | |
module Bar | |
include Foo | |
def call_print_something | |
print_something |
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
module Namespace | |
module Original | |
def print_something | |
"foo" | |
end | |
end | |
end | |
module OtherNameSpace | |
module Dependent |
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
DEPRECATION WARNING: Future versions of RSolr::Ext will require initialization via RSolr::Ext.connect. | |
/home/rochkind/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.0.6/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `to_sym' for nil:NilClass (NoMethodError) | |
from /home/rochkind/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.6/lib/action_dispatch/routing/mapper.rb:1309:in `action_path' | |
from /home/rochkind/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.6/lib/action_dispatch/routing/mapper.rb:1304:in `path_for_action' | |
from /home/rochkind/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.6/lib/action_dispatch/routing/mapper.rb:1159:in `match' | |
from /home/rochkind/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.6/lib/action_dispatch/routing/mapper.rb:1358:in `match' | |
from /home/rochkind/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-3.0.6/lib/action_dispatch/routing/mapper.rb:394:in `map_method' | |
from /home/rochkind/.rvm/gems/ruby-1.8.7-p334/gems/actionpack- |
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
<%= form_tag ... do %> | |
<span>something</span> | |
<%= not_html_safe %> | |
<% end %> | |
That ends up making the entire block inside the form_tag do html escaped, which ordinarily isn't what happens in a view, but since it's inside a 'do' block, it does. | |
...which is why it's important for helper methods that return html to .html_safe it BEFORE they return it, like Rails own helpers do. |
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
<!-- for Solr 1.4, would be different for Solr 3.1+, including using | |
built-in ICU analyzers instead of current custom unicode filters. --> | |
<!-- I don't recall why I used seperate definitions of index and query stage, | |
or if that's needed for anything. --> | |
<!-- NO stopwords in use, to avoid dismax stopwords gotcha. --> | |
<!-- Analyzed Text, no Stemming or Synonyms --> | |
<fieldtype name="textNoStem" class="solr.TextField" positionIncrementGap="100"> |
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
# lib/unstem_solr_params.rb | |
# Add on to CatalogController or another SolrHelper | |
#, to support :unstem_search param to search only un-stemmed fields. | |
module UnstemSolrParams | |
def self.included(klass) | |
# Replace :add_query_to_solr in solr_search_params_logic with | |
# our new method. | |
i = klass.solr_search_params_logic << :add_unstemmed_overrides_to_solr |