Commit Graph

177 Commits

Author SHA1 Message Date
Djordje Vlaisavljevic
f63d550f9c Made the search icon switch to clear button 2022-07-07 16:17:53 +02:00
Djordje Vlaisavljevic
c20b0bfa35 Removed unnecessary icons 2022-07-07 16:17:53 +02:00
Djordje Vlaisavljevic
61e5223885 Added a new clear button 2022-07-07 16:17:53 +02:00
Djordje Vlaisavljevic
a81777b987 Made the animation slightly faster 2022-07-07 16:17:53 +02:00
Rishabh
9678922357 v0.1.3 2022-07-07 16:09:49 +02:00
Rishabh
e4213a223d Added search highlight on title and excerpt
refs https://github.com/TryGhost/Team/issues/1665

- adds bold highlight for search term for title and excerpt
- needs logic to truncate to show excerpt highlight if it cuts out
2022-07-07 16:08:31 +02:00
Rishabh
70cbf57f35 v0.1.2 2022-07-07 15:18:43 +02:00
Djordje Vlaisavljevic
aede4046d8 Removed the outline in Safari 2022-07-07 14:43:08 +02:00
Rishabh
86cba694c2 Added pagination to post results
refs https://github.com/TryGhost/Team/issues/1665

- adds pagination for large post data sets using show more button
2022-07-07 14:40:45 +02:00
Naz
fc264e4108 Switched tokenization in search index
refs https://github.com/TryGhost/Team/issues/1665

- The search should support partial forward lookup to match `foobar` when `fo` or `foob` is typed.
- More about the matching mechanism here: https://github.com/nextapps-de/flexsearch#tokenizer-prefix-search
2022-07-07 14:27:04 +02:00
Naz
32a36057a9 Fixed test for search index
no issue

- The tests had to be updated to match the shape of updated resource queries (limits, ordering, etc.)
2022-07-07 14:22:07 +02:00
Naz
089edbc39c Added 10k limit to resource queries
refs https://github.com/TryGhost/Team/issues/1665

- When requesting 'all' resource the search could experience significant performance degradation and would be unresponsive when there are large amounts of posts/tags/authors on the site
- The limit of 10 000 records was chosen as a stopgap solution for experiments in live environment. Once we verify this limit is not causing much trouble, we could increase it if neede
2022-07-07 12:58:41 +02:00
Naz
ec68dc303c Removed plaintext formats from posts request
refs https://github.com/TryGhost/Team/issues/1665
refs https://github.com/TryGhost/Ghost/issues/10396

- Content API has been updated to return clean results for `excerpt` without require a hacky "&formats=plaintext" parameter
2022-07-07 12:55:08 +02:00
Naz
df3d6cee74 Swapped elasticlunr with flexsearch
refs https://github.com/TryGhost/Team/issues/1665

- elasticlunr in an abandoned package with quite a lot of security vulnerabilities. it also has worse performance memory/processing wise comparing to flexsearch (benchmark: https://nextapps-de.github.io/flexsearch/bench/)
- fusejs was another option that was consideres. it was not chosed due to it's poor performance.
2022-07-07 12:52:09 +02:00
Naz
11f7e89ee3 Added missing tagsIndex initialization
refs https://github.com/TryGhost/Team/issues/1665

- It is not striclty necessary for the tagsIndex declaration to be in the constructor, but it gives a very clear indication of which variables are a part of the class.
2022-07-07 12:52:08 +02:00
Djordje Vlaisavljevic
831014859e Removed unnecessary border 2022-07-07 12:30:55 +02:00
Djordje Vlaisavljevic
552118d02f Added static examples of highlighted keywords in posts results 2022-07-07 12:08:13 +02:00
Rishabh
d24ea3ce55 Updated script url to use admin url
refs https://github.com/TryGhost/Team/issues/1665

- replaces usage of site url to admin url as script only needs admin url for setup
- updates tests
2022-07-07 11:09:53 +02:00
Naz
44c8969192 Switched URL calls to use Content API SDK
refs https://github.com/TryGhost/Team/issues/1665

-  The Content API SDK is the recommended way to interact with the API
2022-07-07 09:41:39 +02:00
Rishabh
2ef8eb0586 Handled opening search popup with data attribute
refs https://github.com/TryGhost/Team/issues/1665

- allows opening search popup in themes with custom data attribute
2022-07-06 17:48:59 +02:00
Rishabh
3369e92627 Removed show more button 2022-07-06 17:48:12 +02:00
Rishabh
bd08f01b8c Added keyboard navigation for search results
refs https://github.com/TryGhost/Team/issues/1665

- adds keyboard navigation for search results using arrow up/down
2022-07-06 17:23:17 +02:00
Djordje Vlaisavljevic
62b4add780 Updated how modal height is calculated 2022-07-06 16:01:26 +02:00
Rishabh
5058e46ec8 Fixed App test
- search url for opening modal was updated
2022-07-06 15:56:20 +02:00
Rishabh
52d00ecc72 Fixed keyboard shortcut for opening search
refs https://github.com/TryGhost/Team/issues/1665

- fix browser hijack of cmd/ctrl + k shortcut for search
2022-07-06 15:52:44 +02:00
Djordje Vlaisavljevic
4743c3939f Switched breakpoint from md to sm 2022-07-06 15:41:28 +02:00
Sanne de Vries
5114157564 Truncated long author and tag names 2022-07-06 15:35:45 +02:00
Djordje Vlaisavljevic
85c7e5c984 Fixed merge conflict issues 2022-07-06 15:34:56 +02:00
Rishabh
312ecdbac3 Disabled default behavior for modal open keyboard shortcut
refs https://github.com/TryGhost/Team/issues/1665

- disables browser behavior for cmd/ctrl+k for opening search modal
2022-07-06 15:31:59 +02:00
Djordje Vlaisavljevic
fa4adcd365 Updated mobile design 2022-07-06 15:29:02 +02:00
Rishabh
1b2f6524cd Added keyboard shortcut for search modal exit
refs https://github.com/TryGhost/Team/issues/1665

- uses esc to exit search modal
2022-07-06 15:26:37 +02:00
Rishabh
6b08ad5978 Added keyboard shortcut to open search modal
refs https://github.com/TryGhost/Team/issues/1665

- adds cmd/ctrl + K shortcut to open the search modal on page
2022-07-06 15:24:12 +02:00
Rishabh
2039f1ac92 Added autofocus to search modal
refs https://github.com/TryGhost/Team/issues/1665

- allows users to type straightaway on opening search modal
2022-07-06 15:24:08 +02:00
Rishabh
fb8765db09 Updated hash path for opening search modal
refs https://github.com/TryGhost/Team/issues/1665

- updates hash path for opening search from `#/sodo-search` to `#/search`
2022-07-06 15:23:40 +02:00
Rishabh
d3e74b8c01 Added css minification
refs https://github.com/TryGhost/Team/issues/1665

- adds css minification to main.css via tailwind/postcss
2022-07-06 15:23:40 +02:00
Sanne de Vries
fb9522e124 Updated search modal shadow 2022-07-06 15:18:12 +02:00
Sanne de Vries
90c5dc7e4e Added show more component 2022-07-06 14:58:05 +02:00
Djordje Vlaisavljevic
3f7f63ede4 Made placeholder avatar less contrasty 2022-07-06 14:47:11 +02:00
Djordje Vlaisavljevic
00d6d2cc43 Added placeholder avatar with first letter of the name 2022-07-06 14:44:58 +02:00
Sanne de Vries
02c9eb772d Added shadow to search box with results 2022-07-06 13:37:39 +02:00
Rishabh
214f60e114 Wired author profile image in search result
refs https://github.com/TryGhost/Team/issues/1665

- shows author profile image if available in search results
2022-07-06 12:44:12 +02:00
Rishabh
55757f3bd1 Wired url for search results
refs https://github.com/TryGhost/Team/issues/1665

- wires url for authors, posts and tags to allow redirect on click
2022-07-06 12:40:35 +02:00
Naz
09ba52039c Added profile_image property to returned search results
refs https://github.com/TryGhost/Team/issues/1665

-  This piece of data is needed to display author's avatars in search results
2022-07-06 12:34:00 +02:00
Rishabh
12b58cb483 Fixed App ui tests
refs https://github.com/TryGhost/Team/issues/1665

- search modal is not opened by default and only triggered on the url
2022-07-06 12:32:42 +02:00
Naz
6ccec26a3a Fixed url attribute to returned search results
refs https://github.com/TryGhost/Team/issues/1665

- The url attribute was not indcluded in the doc index
2022-07-06 12:29:54 +02:00
Rishabh
99f654192f Extended search results to use real author and tags data
refs https://github.com/TryGhost/Team/issues/1665

- matches real author and tag data from search index to show results
2022-07-06 12:28:44 +02:00
Djordje Vlaisavljevic
f1fbe1bf9a Added animations to the modal and the background 2022-07-06 12:24:20 +02:00
Djordje Vlaisavljevic
8f5bb0a448 Added popup and fadein animations to the theme 2022-07-06 12:24:20 +02:00
Sanne de Vries
12791f54e6 Fixed scroll bar bug 2022-07-06 12:08:37 +02:00
Naz
b6ecad0488 Removed local storage caching
refs https://github.com/TryGhost/Team/issues/1665

- This is a premature optimization that's causing loads of roadblocks while everyone is cracking on the feature (the data format changes, etc.)
- Once we are set on the format and need a performance boost we should design a suitable caching mechanism (the current one does not take resource updates into account, so can cause stale content)
2022-07-06 11:42:06 +02:00
Rishabh
9460875638 Added hash link for opening search
refs https://github.com/TryGhost/Team/issues/1665

- adds custom hash url for opening sodo search on site - `/#/sodo-search
- closes the search popup by default
2022-07-06 11:41:54 +02:00
Naz
21a9a4eaba 🐛 Fixed broken index when API returns no results
refs https://github.com/TryGhost/Team/issues/1665

- The search index should be initialized regardless, even if there are no items to put into it the index should be an empty one.
2022-07-06 11:31:23 +02:00
Naz
cc87eb4bc9 Cleaned up initialization test
refs https://github.com/TryGhost/Team/issues/1665

- There is no need to return any data for the initialization test
2022-07-06 11:27:29 +02:00
Naz
8b59245893 Added urls to search resources
refs https://github.com/TryGhost/Team/issues/1665

- We need a way to visit the resource found through search. It should not be included in searchable fields though
2022-07-06 11:26:12 +02:00
Sanne de Vries
b0afdaba10 Increased clickable area for search input 2022-07-06 11:24:22 +02:00
Rishabh
2e8dca570d Fixed display flicker missing class name
refs https://github.com/TryGhost/Team/issues/1665
2022-07-06 11:18:41 +02:00
Rishabh
1f0a6859d8 Removed css load flicker on opening search
refs https://github.com/TryGhost/Team/issues/1665

- removes the flicker caused by lag in css load with inline css override
- adds search close on clicking outside the popup
2022-07-06 11:11:02 +02:00
Rishabh
9fe12641cf v0.1.1 2022-07-06 11:10:03 +02:00
Naz
592e051485 Connected tags to the search index
refs https://github.com/TryGhost/Team/issues/1665

- Tags should be searchable. This change hooks up the Tags Content API with the search index
2022-07-06 10:56:16 +02:00
Naz
dfc5b1c33d Connected authors to the search index
refs https://github.com/TryGhost/Team/issues/1665

- Authors should be searchable. This change hooks up the Authors Content API with the search index
2022-07-06 10:38:00 +02:00
Djordje Vlaisavljevic
906f96827c Fixed position on larger screens 2022-07-06 10:25:01 +02:00
Djordje Vlaisavljevic
b3bbb03c79 Fixed the svg icon flicker 2022-07-06 10:25:01 +02:00
Rishabh
e6c7d66553 Updated package json for publishing upstream
- cleans up package json for publish to npm
2022-07-06 10:17:05 +02:00
Rishabh
d9f7534169 Updated css bundle logic for iframe
refs https://github.com/TryGhost/Team/issues/1665

- css bundle is fetched from an external url, which is different for development and production
- updates bundle to be fetched via unpkg for production using app version
- extracts version information from script tag in root
2022-07-06 10:17:05 +02:00
Djordje Vlaisavljevic
31cb31d5ad Fixed conflicts 2022-07-06 10:16:49 +02:00
Djordje Vlaisavljevic
d15fa439d1 Updated mobile design 2022-07-06 10:13:45 +02:00
Djordje Vlaisavljevic
7e247102f3 Added the close icon 2022-07-06 10:10:22 +02:00
Djordje Vlaisavljevic
7de1877d36 Added max-height for results 2022-07-06 10:10:22 +02:00
Sanne de Vries
b3e8da4df1 Updated search box placeholder 2022-07-06 09:59:39 +02:00
Sanne de Vries
ea21196fa2 Updated clear search results button 2022-07-06 09:57:06 +02:00
Rishabh
36aa8d7558 Updated posts data to use new collection data
- search results are now broken into separate collections for posts, authors and tags
2022-07-05 17:43:52 +02:00
Rishabh
c429b90c11 Fixed empty search result causing UI crash 2022-07-05 17:37:51 +02:00
Naz
df03c47ac1 Search results returning posts as separate attribute
refs https://github.com/TryGhost/Team/issues/1665

- The search results will be handling authors and tags searches as a next step - this change is a groundwork before making this move.
2022-07-05 17:35:29 +02:00
Rishabh
34a3e4ade7 Added redirect for post on search click
- allows click on post result to open it on click when searched
- adds `slug` to content api for data
2022-07-05 17:34:43 +02:00
Sanne de Vries
31b64c032e Updated search box and result spacing 2022-07-05 17:33:56 +02:00
Djordje Vlaisavljevic
a1ed73808a Added background blur when the modal is open 2022-07-05 17:10:02 +02:00
Rishabh
3c0a5c8081 Updated search result to use real posts data
- uses elasticlunr to compare search result with real site post data
2022-07-05 17:01:17 +02:00
Djordje Vlaisavljevic
4243959ac9 Updated clear button 2022-07-05 16:51:29 +02:00
Rishabh
d952c38a7f Removed empty tag section in search
- if no tags match the search, removes the section
2022-07-05 16:44:02 +02:00
Rishabh
98a7b77760 Added no results box to search result 2022-07-05 16:41:05 +02:00
Naz
b77fee0735 Added post properties to search results
refs https://github.com/TryGhost/Team/issues/1665

- The npm package for elasticlunr does not contain the latest changes (no way to include document properties in search results). This hack adds document properties manually.
- Long term we should think about either helping the maintainer with releases of the library or weight out alternatives like fuse.js (https://fusejs.io)
2022-07-05 16:38:37 +02:00
Rishabh
72aa270282 Updated search behavior with local data
- removes section on no search result
- updates clear to remove search string
- updates authors and tags with correct matching data
2022-07-05 16:34:15 +02:00
Djordje Vlaisavljevic
ef921843f4 Added empty results state 2022-07-05 16:29:43 +02:00
Rishabh
5b97a43982 Updated search with local data 2022-07-05 16:25:49 +02:00
Sanne de Vries
84881524d7 Updated placeholder content 2022-07-05 16:21:07 +02:00
Djordje Vlaisavljevic
f44a43c1e9 Made tracking on section headings wider 2022-07-05 16:02:31 +02:00
Djordje Vlaisavljevic
fd1e87a037 Added AuthorAvatar component to handle placeholder avatars 2022-07-05 15:56:56 +02:00
Djordje Vlaisavljevic
bf2166b818 Added placeholder author avatars 2022-07-05 15:51:51 +02:00
Sanne de Vries
3b968ff8a5 Updated search result spacing 2022-07-05 15:38:06 +02:00
Sanne de Vries
e7c9013ffd Added tag items to search results 2022-07-05 15:33:04 +02:00
Djordje Vlaisavljevic
e72cf1a267 Added font antialiasing 2022-07-05 15:18:35 +02:00
Djordje Vlaisavljevic
5f08da04b0 Switched gray to neutral 2022-07-05 15:18:09 +02:00
Djordje Vlaisavljevic
86822e7e6d Added placeholder author results 2022-07-05 15:12:17 +02:00
Rishabh
21b621c4fa Deleted main.css from git 2022-07-05 15:11:51 +02:00
Sanne de Vries
aace61e6f3 Created search box component 2022-07-05 14:44:12 +02:00
Rishabh
093fd604ed Updated search components 2022-07-05 14:39:33 +02:00
Rishabh
0a347e112f Added basic search 2022-07-05 14:39:33 +02:00
Peter Zimon
e5049229c5 Added main.css to gitignore 2022-07-05 14:31:34 +02:00
Djordje Vlaisavljevic
c50a5a14f2 Added placeholder posts 2022-07-05 14:13:01 +02:00
Sanne de Vries
f61dbad9aa Updated search bar design 2022-07-05 13:49:10 +02:00