Closed rallisf1 closed 4 months ago
Nice! Will review this week. What do you think of just a search
param instead of /websearch?q
? That way we wouldn't have to worry about /websearch
resembling a page endpoint, and you could run a search against the whole site, or a specific page.
Like: /api/site_url?search=your search terms
or /api/site_url/page_url?search=your search terms
Searching only within a page's subpages could be useful for things like searching blog posts
Separate endpoints keep the code cleaner. We can still add parent_url
query param to limit the search on subpages.
It's your baby though, so as long as it can still do a whole site search I don't really mind :D
Okay thanks - switched to using a query param isntead and exported the page_search function to keep things clean. I tried modifying it to work on pages but couldn't finish, so that'll have to wait for another day.
Besides that, I also fixed an issue with fetching from root pages (sections
was showing up empty) - caused by querying select('page(parent!inner(url)'
when parent
is null.
I went ahead and added what was discussed on #373
Even more efficient page API
You can now get exactly the sections you need via the page API via a query parameter:
§ions=id1,id2...
Search endpoint
Fancy a search widget for your primo website that uses no 3rd party search service? So did I! Go crazy with
/api/site_url/websearch?q=your search terms
Existing installations need to run the following query in their supabase dashboard:
P.S. Since most people use
search
for their search results page url I thoughtwebsearch
would be the next best candidate. Feel free to change it.P.S.2. I couldn't figure out a better way to get the full url of the result posts. Any improvements are welcome.