Skip to content

Commit

Permalink
Support multiple words in searches
Browse files Browse the repository at this point in the history
Closes #141
  • Loading branch information
tpendragon committed Nov 18, 2016
1 parent 7ca44ca commit 30b53b7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/search_builder/join_children_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(parent_query)
def to_s
return parent_query if parent_query.to_s.start_with?("{!lucene}")
q = queries.map do |query|
"(#{dismax_join(send(query))})"
"_query_: \"#{dismax_join(send(query))}\""
end.join(" OR ")
"{!lucene}#{q}"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/cassettes/mvw.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/controllers/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
resource = IIIFResource.new url: url, exhibit: exhibit
expect(resource.save_and_index).to be_truthy

get :index, params: { q: "SR1", exhibit_id: exhibit.id }
get :index, params: { q: "Scanned Resource", exhibit_id: exhibit.id }

expect(document_ids).to eq [resource.document_builder.to_solr.to_a.first[:id]]
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/iiif_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

docs = Blacklight.default_index.connection.get("select", params: { q: "*:*" })["response"]["docs"]
expect(docs.length).to eq 2
scanned_resource_doc = docs.find { |x| x["full_title_ssim"] == ["SR1"] }
scanned_resource_doc = docs.find { |x| x["full_title_ssim"] == ["Scanned Resource 1"] }
mvw_doc = docs.find { |x| x["full_title_ssim"] == ["MVW"] }
expect(scanned_resource_doc["collection_id_ssim"]).to eq [mvw_doc["id"]]
expect(mvw_doc["collection_id_ssim"]).to eq nil
Expand Down

0 comments on commit 30b53b7

Please sign in to comment.