all repos — searchix @ 58643f38bdd62dc538a03865b1f81eb77d957779

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: show scores in results table in dev mode

Alan Pearce
commit

58643f38bdd62dc538a03865b1f81eb77d957779

parent

1872c47e393e9c4c811f3b90ec2e0ac4cd8767b2

1 file changed, 11 insertions(+), 2 deletions(-)

changed files
M internal/components/packages.templinternal/components/packages.templ
@@ -1,6 +1,7 @@
package components import ( + "go.alanpearce.eu/searchix/internal/config" "go.alanpearce.eu/searchix/internal/index" "go.alanpearce.eu/searchix/internal/nix" )
@@ -12,19 +13,22 @@ <tr>
<th scope="col">Attribute</th> <th scope="col">Name</th> <th scope="col">Description</th> + if config.DevMode { + <th scope="col">Score</th> + } </tr> </thead> <tbody> for _, hit := range result.Hits { if m := convertMatch[nix.Package](hit.Data); m != nil { - @packageRow(*m) + @packageRow(hit, *m) } } </tbody> </table> } -templ packageRow(p nix.Package) { +templ packageRow(hit index.DocumentMatch, p nix.Package) { <tr> <td> @openDialogLink(p.Attribute)
@@ -35,5 +39,10 @@ </td>
<td> { p.Description } </td> + if config.DevMode { + <td> + @score(hit) + </td> + } </tr> }