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
Python 2.6.4 (r264:75706, Jun 4 2010, 18:20:16) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 0.10 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object'. ?object also works, ?? prints more. | |
In [1]: import solr |
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
## IN THE PYTHON VIRTUALENV ## | |
In [1]: import pysolr | |
In [2]: conn = pysolr.Solr('http://adsset:8986/solr/fulltext') | |
In [3]: %timeit r = conn.search('galaxy', fl=['id'], rows=10) | |
1 loops, best of 3: 50 s per loop |
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
16:18:02 cbeer_ | in the routes config for catalog, you can tell the | |
resources mapper what an id looks like | |
16:18:30 cbeer_ | so, for openvault, we have ids like | |
org.wgbh.mla:348bd4b1ae559bcd90abab7b114328312a4bf800 | |
16:19:00 cbeer_ | so my catalog route looks like | |
16:19:06 cbeer_ | map.resources(:catalog, | |
16:19:07 cbeer_ | [...] | |
16:19:11 cbeer_ | requirements => { :id => | |
/([A-Za-z0-9]|-|\.)+:(([A-Za-z0-9])|-|~|_|(%[0-9A-F]{2}))+/ } | |
16:19:13 cbeer_ | ) |
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
# put this in any .rb file in config/initializers , make up your own, put it in an | |
# existing one, whatever works for you. | |
# As with many things in rails/Blacklight, there are many ways to do this, but | |
# this is one, it looks kinda complicated becuase it's trying to deal with | |
# cache_classes=false business. | |
module LocalAssetInclude | |
def add_local_assets | |
# # my_local_stylesheet.css should be found in your app's public/stylesheets/ |
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
def memoize(fn): | |
memory = {} | |
def simple_memoizer(*param_tuple): | |
if param_tuple in memory: | |
return memory[param_tuple] | |
else: | |
memory[param_tuple] = result = fn(*param_tuple) | |
return result | |
return simple_memoizer |
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
require_dependency 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb' | |
class CatalogController < ApplicationController | |
def solr_search_params(extra_controller_params={}) | |
solr_parameters = super extra_controller_params | |
if solr_parameters.key? :q | |
solr_parameters[:q] = solr_parameters[:q].gsub(/\S+/) { |match| | |
if match.include? ':' or match.index('=') != 0 | |
match |
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
Dear Colleagues: | |
I am writing to address the coverage and comments in the news media and online surrounding NPG’s exhibition, “Hide/Seek: Difference and Desire in American Portraiture” which explores the role of gender identity in American portraiture. I toured it early on with curator David Ward and was impressed by the depth of the scholarship and thoughtfulness of the exhibition. | |
Most of the recent attention about the exhibition has focused on 11 seconds of a four-minute video clip, perceived by some to be anti-Christian and intentionally provocative. Neither description could be further from the truth. However, it was clear that this video was detracting from the entirety of the exhibition, so NPG removed the video. | |
That decision was not made lightly or in a vacuum. After consulting with NPG Director Marty Sullivan and others at the museum, and Richard Kurin, Under Secretary for History, Art and Culture, I made the final decision to take down the video. | |
I understand this move is being critici |
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
<similarity class="org.ads.solr.CustomSimilarityFactory"> | |
<lst name="body"> | |
<int name="min">500</int> | |
<int name="max">10000</int> | |
<float name="steepness">0.5</float> | |
</lst> | |
<lst name="body_syn"> | |
<int name="min">500</int> | |
<int name="max">20000</int> | |
<float name="steepness">0.5</float> |
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
Lifting the server siege... done. Transactions: 1957 hits | |
Availability: 100.00 % | |
Elapsed time: 74.76 secs | |
Data transferred: 27.29 MB | |
Response time: 0.08 secs | |
Transaction rate: 26.18 trans/sec | |
Throughput: 0.37 MB/sec | |
Concurrency: 2.05 | |
Successful transactions: 1957 | |
Failed transactions: 0 |