fromthepage
fromthepage copied to clipboard
search within a work
We have a lot of searches, but not one for within a work
@saracarl I feel like once I find the right place it could look something like this. (including the lines below this line) https://github.com/benwbrum/fromthepage/blob/bcdc11bcc5f408a8ba3c1d4e11ebb0febce8f6ca/app/views/dashboard/landing_page.html.slim#L72
Where specifically should there be a search bar? Because there are already search bars in these two spots.
I could, however add one on an actual page, but would it be looking for specific words?
I think the most logical place to put this particular search bar is on the screen that users see when they click on a work name, like https://fromthepage.com/benwbrum/jeremiah-white-graves-diaries/jeremiah-white-graves-diary-volume-2-book-13
That's probably somewhere like app/views/display/read_work
.
@benwbrum If theres is already a search bar looking in the collection in that spot, what would the new one be looking for?
It would only search within that particular work, instead of all the works in the collection.
Sent from my iPhone
On Jul 23, 2020, at 2:27 PM, isabelabarton [email protected] wrote:
@benbrum If theres is already a search bar looking in the collection in that spot, what would the new one be looking for?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
@benwbrum supply 103
https://github.com/benwbrum/fromthepage/blob/f8b4237ef869ae4d237cce3323d2af4d36ad4ff3/app/controllers/display_controller.rb#L96-L104
It looks like all we need to do is replace work_id: @collection.works.ids
with work_id: @work.id
, as in this:
Page.order('work_id, position').joins(:work).where(work_id: @work.id).where("MATCH(search_text) AGAINST(? IN BOOLEAN MODE)", @search_string).paginate(page: params[:page])