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
Boolean search operators / search syntax documentation #329
Comments
No formal syntax has been implemented yet — it's something I'm hoping to do before a 1.0 release but I can't guarantee I'll get to it. There's a small conversation about this in #70 but no work has been started. For some context on the current state: The current search strategy could be thought of as "best effort". Specifically in your case, If one of the two words isn't found anywhere in the search index, then that word will be ignored. So in this case if There shouldn't be a case where you see Hopefully that context helps! In summary
As long as both keywords exist (and aren't common prefixes) then this is the current behaviour. But I am keen on supporting a more formal search documentation 🙂 |
First of all, I would like to thank the authors of Pagefind for this really easy to use search-tool! I stumbled upon this issue because I also thought that Pagefind does not have an What is "missing", though, is to specify word groups, i.e., a sequence of two or more words to search for and require that they be found together. For example, for the famous sentence in Shakespeare's Hamlet:
it is difficult to find Also see Pagefind: Searching in Static Sites. As stated there, it is not a pressing issue, and mostly not important for technical blogs. |
👋 Hey @eklausme! Yes, that kind of adjacency would be great! Ideally, I would like Pagefind to take that into account by default. Given a plain search for That data does already exist when searching — if you search for Not something I have had time for yet, but hopefully will one day! 🙂 |
I'm using Pagefind to show a list of related articles using the current article's tags. Problem is, it only shows articles that have exactly the same tags as the one being viewed. I've solved it by reducing the keyword set until Pagefind returns results. A fuzzy search matching, or one based on OR would be great though. |
@leancept if you're showing a list based on a known set of tags, then filtering sounds like a good path that does support this :) https://pagefind.app/docs/js-api-filtering/#using-compound-filters You would be able to do something like:
|
Is there any formal documentation on the search syntax supported?
Like, is the exclusive "AND" operator supported? If I search for "term1 term2", pagefind seems to treat all searches like all the terms are ORed, so a result will contain at least one result, and maybe others if I'm lucky.
How would I tell pagefind to only return results that contain all the keywords?
The text was updated successfully, but these errors were encountered: