usaco-guide icon indicating copy to clipboard operation
usaco-guide copied to clipboard

Searching Problems

Open bqi343 opened this issue 4 years ago • 29 comments

Incomplete Features

Note that this list is not necessarily ordered by importance.

  • [ ] Dark Mode #4152
  • [ ] better mobile support?
  • [ ] search by + display division (Bronze - Plat) of the module that contains the problem
  • [ ] option to select a random (unsolved) problem from a division
  • [ ] save searches + create problemsets
  • [ ] add link to user solutions? ex. https://usaco.guide/problems/ys-montmort/user-solutions
  • [ ] optimize algolia operations usage? https://github.com/cpinitiative/usaco-guide/issues/86#issuecomment-1873341366
  • [ ] properly handle "search by status"? ie. separate search by status and search by name into two separate searching systems if we exceed 1000 problems / Algolia's limit on refinements: https://github.com/cpinitiative/usaco-guide/pull/4157#discussion_r1439093684

from https://github.com/cpinitiative/usaco-guide/issues/86#issuecomment-788536196 (note that this list may be a bit outdated):

okay so here was what I am thinking (am open to changes):

  • tags should look a lot nicer. Perhaps we can do something like "category" on the e-commerce demo, or add a searchable list of tags, idk. in general tags UI needs to be improved
  • there should be an option to increase the number of hits per page, as well as pagination
  • difficulty / module division should be displayed
  • should have option to filter by difficulty / module(s)
  • should have option to show starred only
  • show whether user solved the problem yet

we should also allow users to use problems page to create randomized problemsets to do. this would entail:

  • all of the filtering functionality above
  • have an option to randomize the problems & hide difficulty / tags / modules
  • (far future) save searches / problemsets

Completed Features

  • [x] search by + display tags
  • [x] search by + display problem name
  • [x] search by + display starred
  • [x] search by + display source
  • [x] search by + display module
  • [x] show whether user solved the problem yet
  • [x] search by + display difficulty (relative to module) #3320
  • [x] option to increase the number of hits per page, as well as pagination #3394
  • [x] option to hide difficulty / tags / modules #3394
  • [x] edit problem status from search page

bqi343 avatar Jul 22 '20 23:07 bqi343

How should search mechanic for this work? Two search bars?

thecodingwizard avatar Jul 22 '20 23:07 thecodingwizard

or should problems be considered as part of a module? Or should we have a dedicated "Problem Search" page (this is probably easiest)?

thecodingwizard avatar Jul 22 '20 23:07 thecodingwizard

both seem fine (something like CSAcademy Archive? https://csacademy.com/contest/archive/)

bqi343 avatar Jul 22 '20 23:07 bqi343

okay let's do a dedicated page. What properties should they be able to search for?

  • problem name
  • tags
  • has solution
  • starred
  • difficulty (relative to module)
  • source
  • ???

thecodingwizard avatar Jul 22 '20 23:07 thecodingwizard

maybe search for difficulty only if division where the problem is located is specified

bqi343 avatar Jul 22 '20 23:07 bqi343

so search by division rather than difficulty? that seems reasonable

thecodingwizard avatar Jul 22 '20 23:07 thecodingwizard

both I guess

bqi343 avatar Jul 22 '20 23:07 bqi343

how do we define "difficulty" though? Our difficulty labels were relative to module...

thecodingwizard avatar Jul 22 '20 23:07 thecodingwizard

I think it's still useful to search by that

bqi343 avatar Jul 22 '20 23:07 bqi343

Before this is implemented, navbar needs to be updated:

  • Dashboard
  • Sections (a dropdown -> General/Bronze/Silver/Gold/Plat/Advanced)
  • Problems List
  • Contact Us
  • search bar
  • login/logout

thecodingwizard avatar Jul 31 '20 09:07 thecodingwizard

oops this turned out to be more nontrivial than I thought. navbar is updated but configuring algolia + setting up problem search page may take some time.

https://github.com/thecodingwizard/usaco-guide/tree/feature/problems

thecodingwizard avatar Aug 01 '20 09:08 thecodingwizard

Bring out of backlog? :o

bqi343 avatar Sep 02 '20 22:09 bqi343

oops I'll try to implement this soon but it might take some time now that school started :(

(Maybe I'll make a preliminary version that allows searching by name at least)

thecodingwizard avatar Sep 02 '20 23:09 thecodingwizard

Request for searching by source (ex. USACO Plat) + difficulty.

bqi343 avatar Nov 22 '20 15:11 bqi343

Difficulty is questionable... (Wormhole sort is both easy and insane XD)

Also searching by source is already doable (just type out the source)

thecodingwizard avatar Nov 22 '20 20:11 thecodingwizard

Difficulty is questionable... (Wormhole sort is both easy and insane XD)

Taking min difficulty could be okay. Also,

hide solution links on the problems page if the user has tags + solutions off

Hide tags as well?

bqi343 avatar Nov 26 '20 20:11 bqi343

Request for searching by source (ex. USACO Plat) + difficulty.

O also contest I guess (ex. Open 19)

bqi343 avatar Dec 12 '20 00:12 bqi343

So like in the problems page what if we had like three filter options, one to search by name, one by tag and one by difficulty, although I think difficulty is pretty relative based on the person.

MrinallU avatar Dec 18 '20 19:12 MrinallU

You should be able to use all three filters at once (see https://react-instantsearch.netlify.app/examples/e-commerce/ or something like that)

thecodingwizard avatar Dec 18 '20 19:12 thecodingwizard

I see...

MrinallU avatar Dec 22 '20 15:12 MrinallU

So does each problem have this data (more specifically does each problem have its own tags and difficulty measure?)

MrinallU avatar Dec 22 '20 15:12 MrinallU

  • todo: fix updating problem tags

bqi343 avatar Feb 11 '21 02:02 bqi343

@thecodingwizard Can I get assigned to this?

MrinallU avatar Feb 16 '21 23:02 MrinallU

okay so here was what I am thinking (am open to changes):

  • tags should look a lot nicer. Perhaps we can do something like "category" on the e-commerce demo, or add a searchable list of tags, idk. in general tags UI needs to be improved
  • there should be an option to increase the number of hits per page, as well as pagination
  • difficulty / module division should be displayed
  • should have option to filter by difficulty / module(s)
  • should have option to show starred only
  • show whether user solved the problem yet

we should also allow users to use problems page to create randomized problemsets to do. this would entail:

  • all of the filtering functionality above
  • have an option to randomize the problems & hide difficulty / tags / modules
  • (far future) save searches / problemsets

thecodingwizard avatar Mar 02 '21 02:03 thecodingwizard

Is this issue closed already? It seems like problem searching is already available.

cirex-web avatar May 17 '22 12:05 cirex-web

no. it's missing features described above :(

thecodingwizard avatar Jun 22 '22 08:06 thecodingwizard

Somehow this happened:

image

I don't think this has ever happened before. We may want to consider optimizing searches / operations usage if this continues to be a problem.

image

(cc @devo1ution)

thecodingwizard avatar Jan 01 '24 14:01 thecodingwizard

oh shoot wait im so sorry...I think each individual refine call got counted as an operation so filtering to not attempted would immediately take ~1000 operations 😭 I've changed it to use setIndexUiState to combine all these operations into 1, so we shouldn't run into this issue in the future.

Sorry!

Also if we have to pay for a temporary upgrade (if thats a thing) I'm completely willing to 😓

danielzsh avatar Jan 01 '24 17:01 danielzsh

Oh that makes sense, thanks for letting me know! Don't worry about it -- mistakes happen and this is totally fine as long as it's not likely to be a recurring issue.

Also if we have to pay for a temporary upgrade (if thats a thing) I'm completely willing to 😓

Thanks very kind of you but you really don't have to (CPI will generally pay for all development costs, including mistakes)! I was trying to see if it's possible to temporarily upgrade the plan, but we're on a legacy open-source plan so I don't even see the option to pay for more usage at the moment :p

thecodingwizard avatar Jan 01 '24 22:01 thecodingwizard