sethjohnson1 / conflist5

Conflist cakePHP5
1 stars 0 forks source link

"advanced" search #18

Closed nilesjohnson closed 1 month ago

nilesjohnson commented 2 months ago

really just a basic search by field form, like at https://mathmeetings.net/conferences/search/

One nice improvement would be to allow a query string, so that people can bookmark a search for whatever weird conditions they prefer (created or modified within certain window, location certain country, etc.). Is that easy to do?

sethjohnson1 commented 2 months ago

Update created/modified where null

nilesjohnson commented 2 months ago

working better; let me know if you have ideas about these two remaining issues:

  1. With multiple tags selected, only the last one is processed. Each selected tag is listed as a separate value of the same field, like search?tag_select=ac&tag_select=cv&tag_select=dg, and the results of $this->request->getQuery() only show the last one. This must be the core problem, but I don't know how to access the multiple GET values, or combine the selected items into a single value.

  2. Whatever tags are selected, they don't get autofilled into the search form The other data in the search is repopulated into the search fields (I did this manually; is there a better "cake" way?). For selected tags, I just don't know how to do it, and the previous item is a barrier anyway.

sethjohnson1 commented 2 months ago
  1. would need to be tag_select[]=ac&tag_select[]=cv that passes an array, otherwise you're right the last one will overwrite the key val
  2. Take a look at my latest commit - might need a little code cleanup since $tagstring can be either an array or string now - but that is the easiest way to select the multiselect vals
sethjohnson1 commented 2 months ago

Just another note here: I will take a look at this and cleanup shortly. I think this is the way to do it: ✅ Form uses POST instead of GET ✅ Controller checks for POST, if set then processes search and just redirects to page with query string. 🤔 Why? without some management, the query string can run wild - so we clean it up on every form POST - there are other ways to avoid the redirect using JS, but they are all fiddly.

Check it now

nilesjohnson commented 2 months ago

ha ha, ok that is actually reasonable; I fiddled with it some and did some cleanups. I think it's ready?

nilesjohnson commented 1 month ago

seems good; closing!