pdoc icon indicating copy to clipboard operation
pdoc copied to clipboard

search always gives no results

Open thesadru opened this issue 3 years ago • 8 comments

Expected Behavior

The search should return a list of results.

Actual Behavior

The search always returns No results.

Steps to Reproduce

  1. Generate docs with a config.mako in this style:
<%!
    git_link_template = 'https://github.com/thesadru/genshinstats/blob/{commit}/{path}#L{start_line}-L{end_line}'
    google_search_query = '''
        inurl:github.com/thesadru/genshinstats
        site:thesadru.github.io
    '''
%>
  1. Try to search anything

alternatively just search on the Github pages I'm trying to use

https://thesadru.github.io/pdoc/genshinstats/

Additional info

  • pdoc version: 0.9.2

I'm so sorry if this is some obvious bug, but I just can't figure out why.

screenshot: image

thesadru avatar Mar 24 '21 10:03 thesadru

This is the same as the configuration we are using, so it should work.

I notice Google only returns a single result for (site:thesadru.github.io OR inurl:github.com/thesadru/genshinstats) wrapper. If fairly new, perhaps you need to wait a few more days for the sites, particularly the subdomain one, to get more properly indexed.

As an alternative, you can use JS-based index/search: https://github.com/pdoc3/pdoc/blob/c2c13200a630f97e5a7b2cba292b0dc9deb58b53/pdoc/templates/config.mako#L51-L56

kernc avatar Mar 24 '21 15:03 kernc

I don't have much experience with lunr.js, so I didn't want to use it at first, but I'll use that then. I'll just hope it's only because it wasn't indexed yet. Thanks for the tip.

thesadru avatar Mar 24 '21 19:03 thesadru

Google still hasn't indexed the site so I'm just gonna close this issue.

thesadru avatar Mar 26 '21 08:03 thesadru

It sometimes takes days up to a few weeks. Let's keep this open, so it reminds me to check again later. I'd like to confirm.

kernc avatar Mar 26 '21 11:03 kernc

Also experiencing this issue. My config.mako:

<%!
    # Use `{commit}` instead of `master` to insert current commit hash
    git_link_template = 'https://github.com/nansencenter/DAPPER/blob/master/{path}#L{start_line}-L{end_line}'

    sort_identifiers = False
    # show_type_annotations = True
    # show_source_code = False
    latex_math = True
    google_search_query = 'site:nansencenter.github.io/DAPPER'
%>

Googling site:nansencenter.github.io/DAPPER stats produces many results

But only 1 hit when going through the local search box: Screenshot 2022-05-23 at 15 06 20

patnr avatar May 23 '22 13:05 patnr

@patnr I have no explanation for it, but this is indeed what the custom search engine returns for this query.

Is the website fairly new? Maybe wait a while longer.

There's another search method using Lunr.js search: https://github.com/pdoc3/pdoc/blob/c2c13200a630f97e5a7b2cba292b0dc9deb58b53/pdoc/templates/config.mako#L51-L56 Does that work for you?

kernc avatar May 23 '22 13:05 kernc

Thank you for the swift reply!

The website is >1 years old, and as you can see Google already very much indexes it. I'm not very experienced with web development, but do you have any pointers as to how I might track down the issue?

I will give lunr.js a try as well.

patnr avatar May 23 '22 14:05 patnr

I tried creating my own search engine at https://cse.google.com/ . This works great.

So maybe the problem is with the cx token used by pdoc? https://github.com/pdoc3/pdoc/blob/c2c13200a630f97e5a7b2cba292b0dc9deb58b53/pdoc/templates/html.mako#L403 Could we allow for it to be a key in config.mako ? I'd be happy to make a PR

patnr avatar May 23 '22 14:05 patnr