Skip to content

Take into account url query params (url.search) into results #48

Open
@devstgo

Description

@devstgo

Description

Query params are not used when SearchBar and SearchPage adapt the url from Typesense server response to docusaurus component.

Steps to reproduce

Scrap a website with some url with query params
Do a search in docusaurus
Check that response from typesense server return the query param in the response
Inspect the docusaurus href link and verify that link skips query params.

Expected Behavior

The href field has to take into account the query params

Actual Behavior

The actual code only has into account pathname and hash.

docusaurus-theme-search-typesense/src/theme/SearchPage/index.tsx line 284 concat parsedURL.search:

            url: isRegexpStringMatch(externalUrlRegex, parsedURL.href)
              ? parsedURL.href
              : parsedURL.pathname + parsedURL.search +  parsedURL.hash,

In the same way, we had to do the same modification into docusaurus-theme-search-typesense/src/theme/SearchBar/index.tsx at line 193:

url: withBaseUrl(`${url.pathname}${url.search}${url.hash}`),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions