Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crum/Xooxle] Improve User Experience #229

Closed
pishoyg opened this issue Sep 4, 2024 · 40 comments
Closed

[Crum/Xooxle] Improve User Experience #229

pishoyg opened this issue Sep 4, 2024 · 40 comments
Assignees
Labels
maintenance What: Small fix UI Why: Better user interface user Why: User convenience
Milestone

Comments

@pishoyg
Copy link
Owner

pishoyg commented Sep 4, 2024

TODO:

  • Add an option to search for a whole word only.
  • Fix query highlighting using :~:text=. Support it for both whole-word and simple search.
  • Add an option to search using regex.
  • Performance: Load the index at most once.
  • Responsiveness: Load the page first and let the index load in the background.
  • Responsiveness: Update the display with partial results, instead of waiting for the whole list before updating display.
@pishoyg pishoyg added the UI Why: Better user interface label Sep 4, 2024
@pishoyg pishoyg added this to the Pipeline: Site milestone Sep 4, 2024
pishoyg added a commit that referenced this issue Sep 4, 2024
- Make sure the index is loaded at most once.
- Run the script with `defer`. Hopefully, this means the page will get
  loaded first, and the index will get loaded in the background.
- Use a stack of comprehensions instead of creating intermediate lists.
  We had an impression (which empirical date did NOT corroborate) that
  this will make it possible to update the display while more results
  are being retrieved, instead of waiting for all results to be
  retrieved and then updating the display once. This doesn't seem to be
  the case empirically though, but we don't possess sufficient
  JavaScript wizardry skills to make the display update asynchronous. We
  retain the change anyway, because it's (arguably) more aesthetic.
pishoyg added a commit that referenced this issue Sep 4, 2024
Summary of changes:
- Add an option to restrict the search to full-word matches only.
- Add an option to use regular expressions.
- Update the display as results are generated, instead of waiting for
  all results to be retrieved and then updating the display.
  Notice that we abort an ongoing search if a new search query is
  received.
- Searching with an empty query clears the results.
- URI-encode the text fragment.
- Use full-word matches for the text fragment, thus rendering the
  directive more useful.
- Handle potential JSON errors.

NOTE: We already load the index in the background without letting it
block loading the page, nothing to do here.

NOTE: This commit was mostly implemented using ChatGPT.
pishoyg added a commit that referenced this issue Sep 4, 2024
This is obviously related to #171, but you might be wondering how it has
anything to do with #229.
The answer is that, with the current HTML, some text extractors see
"Crum" and whatever precedes it as a single word, thus messing up with
our search function (and also with text highlighting experience in the
browser). Adding a line break is a way to ensure that this doesn't
happen.
pishoyg added a commit that referenced this issue Sep 4, 2024
Pick up a change introduced in f7691b8,
and propagated to the HTML in f1114e6
(we use HTML as a source for the `xooxle` recipe, so the code change
wouldn't be picked up otherwise). Examine with `diff` with the
`--word-diff` command to see the exact fix.
@pishoyg
Copy link
Owner Author

pishoyg commented Sep 4, 2024

Status:
All suggestions in the first comment have been addressed. Now we have a few ones:

Summary TODO:

  • Add a third column in the search results that shows the context (where the match occurs in the text).
  • The matching text should be highlighted in that context.
  • If multiple matches are found, they should all be highlighted.
  • The text that we search (which is generated by make xooxle) should be retained on several lines. So '\n'.join(' '.join(line.split()) for line in text.split('\n')) instead of your current ' '.join(line.split()).
  • The context should be shown on a line-by-line basis. We could perhaps highlight the match in one line at a time.
  • It's not possible for the text fragment directive to highlight several matches. Mention that in a popup that shows when you hover? Or maybe just ignore this fact, since the context column will show all matches.
  • Show the dialects in the title.
  • Display a warning message about Google's index not getting updated often.
  • (slightly more involved) Exclude irrelevant elements (such as Dawoud and Crum, or the keys).
  • (slightly more involved) Implement dialect-oriented search, perhaps utilizing the fact that your text now goes on several lines.

@pishoyg pishoyg modified the milestones: Pipeline: Site, Site v1.0 Sep 4, 2024
@pishoyg
Copy link
Owner Author

pishoyg commented Sep 4, 2024

This is, at least partially, highly desirable (and feasible). Moving to the v1.0 milestone.

@pishoyg
Copy link
Owner Author

pishoyg commented Sep 4, 2024

TODO: Number the list with Roman numerals.

@pishoyg
Copy link
Owner Author

pishoyg commented Sep 4, 2024

Most elements in the HTML seem to have classes that we can use to exclude them from the search, except "Crum", "Dawoud", and the page numbers below the Dawoud dictionary scans.

pishoyg added a commit that referenced this issue Sep 4, 2024
- Add a link to JavaScript syntax page.
- Add a link to the site's home page.
- Add some horizontal lines.
pishoyg added a commit that referenced this issue Sep 4, 2024
We add the following classes:
- "root-type" refers to the root type.
- "marcion" refers to the full entry block.
- "meaning" refers to the meaning block.
- "dictionary" refers to the dictionary pages blocks.
- "crum" refers to the string "Crum".
- "dawoud" refers to the string "Dawoud".
- "dawoud-page-external" refers to the Dawoud page numbers right beneath
  the scans.
- "dawoud-page-img" refers to the Dawoud page images.

NOTE: "dawoud-page-external" uses to refer to the images. We modify it
to maintain consistency with Crum.
pishoyg added a commit that referenced this issue Sep 4, 2024
Pick up removing some classes from the index text.
@pishoyg
Copy link
Owner Author

pishoyg commented Sep 5, 2024

Status:

  • Many of the suggestions made earlier have been implemented (particularly removing noise from the text that we search, retaining lines, showing context).
  • We will NOT use Roman numerals because the list already has numbers.
  • We are starting to question whether we actually want the dialects to appear in the title.

Summary TODO:

  1. (nit) Separate the rows by lines to make it more reader-friendly.
  2. (nit) If multiple matches are found on the same line, they should all be highlighted.
  3. (more involved) Implement dialect-oriented search, perhaps utilizing the fact that your text now goes on several lines.
  4. (implementation unclear) If you could update the display as users type, that would be great. Right now, it seems to cause some jitter (which could be remedied by perhaps updating the display only once per search, rather than yielding to update the display for each search result), and the text that gets searched is always missing the last letter!
  5. (reconsidered) It's not possible for the text fragment directive to highlight several matches. Mention that in a popup that shows when you hover? Or maybe just ignore this fact, since the context column will show all matches.
  6. (reconsidered) Show the dialects in the title.

@pishoyg
Copy link
Owner Author

pishoyg commented Sep 5, 2024

TODO: Words have a hyperlink to the page, don't put the page on a separate column.

@pishoyg
Copy link
Owner Author

pishoyg commented Sep 6, 2024

TODO:

  • (reconsidered) Results open in a new tab.
  • (reconsidered) When you search for an English word, consider the word's synonyms and inflections, so you can make the search experience even better.

@pishoyg
Copy link
Owner Author

pishoyg commented Sep 6, 2024

Status:

Done:

  1. If you could update the display as users type, that would be great. Right now, it seems to cause some jitter (which could be remedied by perhaps updating the display only once per search, rather than yielding to update the display for each search result), and the text that gets searched is always missing the last letter!
  2. Words have a hyperlink to the page, don't put the page on a separate column.
  3. Separate the rows by lines to make it more reader-friendly.

Rejected:

  1. It's not possible for the text fragment directive to highlight several matches. Mention that in a popup that shows when you hover? Or maybe just ignore this fact, since the context column will show all matches.
  2. Results open in a new tab.

TODO:

Nit:

  1. Search responds to keypresses, not just input.
  2. Show the dialects in the title.
  3. If multiple matches are found on the same line, they should all be highlighted.
  4. Implement your own highlighting and scrolling in JavaScript. Don't rely on Chrome.

More involved:

  1. Implement dialect-oriented search, perhaps utilizing the fact that your text now goes on several lines.

Low-priority:

  1. When you search for an English word, consider the word's synonyms and inflections, so you can make the search experience even better.

@pishoyg
Copy link
Owner Author

pishoyg commented Nov 1, 2024

Status:

Moved:

  1. Perform normalization beyond changing to lower case. (Then close [Crum/Xooxle] Perform Normalization beyond Changing to Lower Case #253 as completed.)

TODO (low-priority):

  1. Eliminate view cell jitter, which results from removing and readding indexes!
  2. Make it possible to copy the results to the clipboard, or export them to a CSV or excel!
  3. When you search for an English word, consider the word's synonyms and inflections, so you can make the search experience even better.
  4. A long press on n or p should keep scrolling through the results!

pishoyg added a commit that referenced this issue Nov 1, 2024
This has the side effect that long presses result in the event being
registered repeatedly.
pishoyg added a commit that referenced this issue Nov 2, 2024
The only observable side effect of letting the event propagate is that,
when clicking `/` to highlight the search box, the character `/` is also
written into the search box.
pishoyg added a commit that referenced this issue Nov 18, 2024
Determinism is helpful when comparing the outputs of different
configurations.
pishoyg added a commit that referenced this issue Nov 18, 2024
pishoyg added a commit that referenced this issue Nov 19, 2024
There is no need to fill large spaces with titles. The search
functionality is more worthy of the space.

Also keep the search panel (search box and checkboxes) on the same line
on mobile.
@pishoyg
Copy link
Owner Author

pishoyg commented Nov 24, 2024

Status:

DONE:

  1. A long press on n or p should keep scrolling through the results (fixed in 6f7e309)!

TODO (low-priority):

  1. Eliminate view cell jitter, which results from removing and readding indexes!
  2. Make it possible to copy the results to the clipboard, or export them to a CSV or excel!
  3. When you search for an English word, consider the word's synonyms and inflections, so you can make the search experience even better.1

Footnotes

  1. Although we have enabled the Google search panel, it seems good at recognizing basic inflections, but not great at working with synonyms!

@pishoyg
Copy link
Owner Author

pishoyg commented Nov 25, 2024

Status:

Moved:

  1. Eliminate view cell jitter, which results from removing and readding indexes! [Site/Xooxle] Eliminte view Cell Jitter #300
  2. Make it possible to copy the results to the clipboard, or export them to a CSV or excel! [Site/Xooxle] Add copy Buttons for Cells / Rows #301
  3. When you search for an English word, consider the word's synonyms and inflections, so you can make the search experience even better.1 [Site/Xooxle] Consider English Synonyms and Inflections in Xooxle Search #302

Footnotes

  1. Although we have enabled the Google search panel, it seems good at recognizing basic inflections, but not great at working with synonyms!

@pishoyg pishoyg closed this as completed Nov 25, 2024
@github-project-automation github-project-automation bot moved this to Done in coptic Nov 25, 2024
@pishoyg
Copy link
Owner Author

pishoyg commented Nov 25, 2024

Huge, general-purpose issues are a bad idea! See!

pishoyg added a commit that referenced this issue Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance What: Small fix UI Why: Better user interface user Why: User convenience
Projects
Archived in project
Development

No branches or pull requests

1 participant