Skip to content

What's the best way to understand why a specific result is shown? #584

Answered by bglw
nhoizey asked this question in Q&A
Discussion options

You must be logged in to vote

Ah, yes this is an interesting one.

At the moment, Pagefind doesn't include metadata in the searchable index — they're two separate systems, essentially.

In this case, your title:

<h1 class="p-name" data-pagefind-meta="title">A sphinx moth in the making</h1>

Is outside your indexed body:

<div class="description e-content" data-pagefind-body=""> ...

This puts it in the metadata, but not in the index. As a result, nothing is in the index with sphinx, and Pagefind regresses your search term all the way back to s to try find some result. (Possibly not the most helpful step, but Pagefind really likes giving some result over nothing).

Fix here is to chuck a data-pagefind-body on your h1 as we…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@nhoizey
Comment options

@rea1shane
Comment options

Answer selected by nhoizey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants