Commit Graph

17 Commits

Author SHA1 Message Date
Navendu Pottekkat
f7bd1ec07c
feat: add configurable limit to search results (#1281)
* feat: add configurable limit to search results

Signed-off-by: Navendu Pottekkat <navendu@apache.org>

* Handle case where params.fuseOpts is not defined
resulting into `Cannot read properties of null (reading 'limit')`


Utilizes search options by fuse https://www.fusejs.io/api/methods.html#search 

The options:

limit (type: number): Denotes the max number of returned search results.

---------

Signed-off-by: Navendu Pottekkat <navendu@apache.org>
Co-authored-by: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
2023-08-12 13:17:24 +05:30
bentonw414
1f0f294c85
Use Nullish Coalescing Operator with Fastsearch (#1033) 2022-09-02 21:32:32 +05:30
Aditya Telange
198a4d74ae
Fix Code Smell: Unexpected var, use let or const instead.
https://sonarcloud.io/project/issues?issues=AYEpqxwP3DjyH4ZzxfLw&open=AYEpqxwP3DjyH4ZzxfLw&id=adityatelange_hugo-PaperMod
2022-08-20 14:20:51 +05:30
Aditya Telange
d81b87938b
Fix params.fuseOpts being ignored by Fuse.js
by implementing a map of lower case to camel case parameters

fixes: #556
2021-10-30 13:42:38 +05:30
Aditya Telange
d76bc91ed0
Reduce Cognitive Complexity of fastsearch.js (#554) 2021-09-04 15:44:22 +05:30
Aditya Telange
f1bc3471a6
Fix focus ghosting in search results O_o 2021-04-10 00:59:24 +05:30
Aditya Telange
c255d148d8
Fix results being searched before index building;
refactor resultSet generation to fix duplicate items with large db
2021-04-10 00:58:40 +05:30
Aditya Telange
ba48765e2c
Use js.Build to fetch fuseOpts;
also load Search on window load
2021-04-10 00:58:23 +05:30
Aditya Telange
e03348c041
improve search
- fix menu element becoming inactive
      change class active -> focus
    - set input type seach #198
    - add a reset func
    - add script to clear searchbox
      when clicked on X sign
2021-02-07 21:40:27 +05:30
Aditya Telange
f64c44c8d2
tweak fuse opts
-rm default opts,
- add ignoreLocation (to search everywhere not just 1st 60 chars)
- ref https://fusejs.io/concepts/scoring-theory.html#scoring-theory
2021-01-30 12:08:19 +05:30
Aditya Telange
624b1d0afb
trim whitespace before searching 2021-01-30 12:08:09 +05:30
Aditya Telange
8222f2bd11
fix search result multiple hightlight on lost focus
also use set vars instead of fetching element again
2021-01-16 13:26:55 +05:30
Aditya Telange
bccce36c98
search: use kb nav only inside searchbox
rm 'prevent mouseclick to change active element'
2020-12-18 21:25:34 +05:30
Aditya Telange
b7f8749cdf
Search: Keyboard Bindings for easier navigation (#138)
* set up basic actions on keypress
* add actions to perform conditionally
* add simple highlight animation
* prevent mouseclick to change active element
* clear input box on Escape
* click on Arrow Right
* clear results and focus search-input on esc
* refactor
2020-12-18 11:45:10 +05:30
Aditya Telange
77ff1e6b45
search: introduce loading custom fusejs options from site config #134
* refer https://fusejs.io/api/options.html for opts
* keys used can be some, all or none from
   ["title", "permalink", "summary", "content"]

in config.yml, add fuseOpts as shown below =>
  params:
    fuseOpts:
        isCaseSensitive: false
        shouldSort: true
        location: 0
        distance: 1000
        threshold: 0.4
        minMatchCharLength: 0
        keys: ["title", "permalink", "summary", "content"]
2020-12-15 18:57:42 +05:30
Aditya Telange
bb2717a3b9
search: fix redundant results after clearing searchbox 2020-12-06 19:44:36 +05:30
Aditya Telange
4a4408573e
search: init Search feature (#105)
* based on https://gist.github.com/cmod/5410eae147e4318164258742dd053993
* modified working for PaperMod
* fetches current lang index.json for search
* add fuse.js v6.4.3 LICENSE: Apache License 2.0
* bundled fastsearch and fusejs as search.js

Co-authored-by: Craig Mod <stuff@craigmod.com>
2020-12-06 18:19:50 +05:30