Skip to content

Instantly share code, notes, and snippets.

View jcoyne's full-sized avatar

Justin Coyne jcoyne

  • Stanford University Libraries
  • Minneapolis, MN
View GitHub Profile
HTTP GET (8.38ms) http://127.0.0.1:8983/solr/test/select?wt=ruby&qt=search&facet.field=active_fedora_model_ssi&facet.field=location_label_sim&facet.field=creator_label_sim&facet.field=lc_subject_label_sim&facet.field=publisher_sim&facet.field=year_iim&facet.field=form_of_work_label_sim&facet.field=collection_label_ssim&fq=has_model_ssim:("Image")&qf=title_tesim+lc_subject_label_tesim&rows=10&sort=score+desc,+date_si+desc,+creator_label_si+asc
Response status Net::HTTPOK (200)
Response body {'responseHeader'=>{'status'=>0,'QTime'=>4,'params'=>{'sort'=>'score desc, date_si desc, creator_label_si asc','qf'=>'title_tesim lc_subject_label_tesim','facet.field'=>['active_fedora_model_ssi','location_label_sim','creator_label_sim','lc_subject_label_sim','publisher_sim','year_iim','form_of_work_label_sim','collection_label_ssim'],'qt'=>'search','wt'=>'ruby','fq'=>'has_model_ssim:("Image")','rows'=>'10'}},'response'=>{'numFound'=>1,'start'=>0,'maxScore'=>1.0,'docs'=>[{'system_create_dtsi'=>'2015-03-04T19:26:04Z','system
CONSTRUCT
{ <http://id.loc.gov/authorities/names/n79041717> ?p ?o . }
WHERE
{ <http://id.loc.gov/authorities/names/n79041717> ?p ?o . }
sparql = SPARQL::Client.new('http://localhost:8888/marmotta/sparql')
query = sparql.select.where([:s, :p, :o]).offset(100).limit(10)
query.each_statement do |statement|
puts statement.inspect
end
SPARQL::Client::ClientError: impossible to determine which type of operation (query/update) the request contains Processing query SELECT * WHERE { ?s ?p ?o . } OFFSET 100 LIMIT 10
from /Users/justin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/sparql-client-1.1.3.1/lib/sparql/client.rb:342:in `block in response'
...
I, [2015-02-25T22:10:01.672464 #12115] INFO -- : Completed 500 Internal Server Error in 1209ms
F, [2015-02-25T22:10:01.674429 #12115] FATAL -- :
ActionView::Template::Error (undefined local variable or method `document_counter' for #<#<Class:0x007fe22d992840>:0x007fe2184b5260>):
1: <%- if has_thumbnail?(document) && tn = render_thumbnail_tag(document, {}, :counter => document_counter_with_offset(document_counter)) %>
2: <div class="document-thumbnail">
3: <%= tn %>
4: </div>
app/views/collections/show.html.erb:38:in `_app_views_collections_show_html_erb___378241852717519267_70304702122340'
@jcoyne
jcoyne / gist:504dd7cceff006daba6d
Created February 19, 2015 01:17
How to use solr to query members of a colection
# http://search-lucene.com/javadoc/lucene/core/org/apache/lucene/search/DocValuesTermsFilter.html
solr_parameters[:fq] << "{!terms f=id method=docValuesTermsFilter}#{@collection.member_ids.join(',')}"
ActionView::Template::Error:
arguments passed to url_for can't be handled. Please require routes or provide your own implementation
# /Users/justin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionview-4.1.8/lib/action_view/helpers/url_helper.rb:38:in `url_for'
# /Users/justin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:230:in `call'
# /Users/justin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:181:in `call'
# /Users/justin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:270:in `block (2 levels) in define_url_helper'
# /Users/justin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/blacklight-5.9.0/app/helpers/blacklight/url_helper_behavior.rb:85:in `session_tracking_params'
# /Users/justin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/blacklight-5.9.0/app/helpers/blacklight/url_helper_behavi
var Foo = function(element, options) {
var basic_manager = new HydraEditor.FieldManager(element, options);
basic_manager.createNewField = function(stuff) {
this.updateName(stuff); // Causes: "undefined is not a function"
}
return basic_manager;
}
Foo.prototype = {
(byebug) p resource.creator
[#<Oargun::ControlledVocabularies::Creator:0x3ff7ed22b620(default)>, #<Oargun::ControlledVocabularies::Creator:0x3ff7ebe8c434(default)>]
(byebug) p resource.save
true
(byebug) p resource.creator
[]
require 'spec_helper'
describe 'A controlled vocabulary' do
before do
class Foo < ActiveTriples::Resource
property :lcsubject, predicate: RDF::DC.subject, class_name: Oargun::ControlledVocabularies::Subject do |index|
index.as :stored_searchable
end
end
end
irb(main):005:0> GenericFile.create! { |f| f.apply_depositor_metadata('jcoyne') }
D, [2014-12-10T07:46:07.518807 #79849] DEBUG -- : HTTP POST (10.48ms) http://127.0.0.1:8983/fedora/rest/dev
D, [2014-12-10T07:46:07.518892 #79849] DEBUG -- : Request body
<> <http://id.loc.gov/vocabulary/relators/dpt> "jcoyne";
<info:fedora/fedora-system:def/model#hasModel> "GenericFile" .
D, [2014-12-10T07:46:07.518946 #79849] DEBUG -- : Response status Net::HTTPCreated (201)
D, [2014-12-10T07:46:07.518999 #79849] DEBUG -- : Response body http://127.0.0.1:8983/fedora/rest/dev/a9/6b/ec/4e/a96bec4e-c7f6-49f7-8d27-eecd10e67408
D, [2014-12-10T07:46:07.526819 #79849] DEBUG -- : HTTP HEAD (6.56ms) http://127.0.0.1:8983/fedora/rest/dev/a9/6b/ec/4e/a96bec4e-c7f6-49f7-8d27-eecd10e67408/content
D, [2014-12-10T07:46:07.526919 #79849] DEBUG -- : Response status Net::HTTPNotFound (404)