fromthepage icon indicating copy to clipboard operation
fromthepage copied to clipboard

search within a work

Open saracarl opened this issue 4 years ago • 6 comments

We have a lot of searches, but not one for within a work

saracarl avatar Jun 22 '20 01:06 saracarl

@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. Screen Shot 2020-07-23 at 1 37 36 PM Screen Shot 2020-07-23 at 1 37 44 PM

I could, however add one on an actual page, but would it be looking for specific words? Screen Shot 2020-07-23 at 1 37 56 PM

isabelabarton avatar Jul 23 '20 18:07 isabelabarton

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 avatar Jul 23 '20 19:07 benwbrum

@benwbrum If theres is already a search bar looking in the collection in that spot, what would the new one be looking for?

isabelabarton avatar Jul 23 '20 19:07 isabelabarton

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 avatar Jul 23 '20 19:07 benwbrum

@benwbrum supply 103

https://github.com/benwbrum/fromthepage/blob/f8b4237ef869ae4d237cce3323d2af4d36ad4ff3/app/controllers/display_controller.rb#L96-L104

isabelabarton avatar Jul 23 '20 20:07 isabelabarton

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])

benwbrum avatar Aug 04 '20 17:08 benwbrum