boostorg / website-v2

New Boost website
https://boost.io
Boost Software License 1.0
9 stars 10 forks source link

site-docs search bar #255

Closed alandefreitas closed 1 year ago

alandefreitas commented 1 year ago

The search bar is disabled in pages like

https://www.boost.revsys.dev/doc/user-guide/

Maybe it's just out of date.

I don't know where the content comes from to boost.revsys.dev, but the docs are being sent to buckets from cppalliance/site-docs and cppalliance/boost. They work fine in the previews, for instance:

https://45.site-docs.prtest2.cppalliance.org/user-guide/index.html

frankwiles commented 1 year ago

We're pulling our content from the revsys.boost.dev bucket only FYI

alandefreitas commented 1 year ago

In the revsys.boost.dev bucket we have:

To be specific, since https://www.boost.revsys.dev/doc/user-guide/ has no ref_name, where is this content coming from and how often is it pulled? It would be good to have an idea so we can also try to find out why the search bar isn't working.

frankwiles commented 1 year ago

Ah yeah I see why you're confused. We're rewriting the paths using the mapping in stage_static_config.json

So /doc/user-guide/ is coming from s3://boost.revsys.dev/site-docs/develop/user-guide/ specfically.

It pulls the files directly from S3 (not periodically) however it's cached and it seems the cache is set for a very long time (effectively infinite) @williln can you adjust the caching in StaticContentTemplateView to be pull from a setting and have it default to 1 minute for now.

vinniefalco commented 1 year ago

I don't have time to wait for infinite

frankwiles commented 1 year ago

You and me both my friend!

williln commented 1 year ago

@frankwiles forcing the content type didn't seem to work.

This is a truncated example of what the cached value looks like (from inside the dev pod):

In [15]: static_cache.get("static_content_doc/user-guide/")
Out[15]:
(b'<!DOCTYPE html>\n<html lang="en">\n  <head>\n    <meta charset="utf-8">\n    <meta name="viewport" content="width=device-width,initial-scale=1">\n    <title>User Guide :: Boost Site Docs</title>\n    <link rel="canonical" href="https://antora.cppalliance.org/user-guide/index.html">\n    
...
\n<script src="../_/js/search-ui.js" id="search-ui-script" data-site-root-path=".." data-snippet-length="100" data-stylesheet="../_/css/search.css"></script>\n<script async src="../search-index.js"></script>\n<script async src="../_/js/vendor/tabs.js" data-sync-storage-key="preferred-tab"></script>\n\n  </body>\n</html>\n',
 'text/html')

This is the bit that isn't loading: <script async src="../search-index.js">. I'm not sure how all of this works behind the scenes -- is the problem that S3 is serving the HTML file and we just can't access the MIME type of the JS files that are being served as well? Here is the PR I merged: https://github.com/cppalliance/temp-site/pull/328

williln commented 1 year ago

Leaving some notes here:

{'ResponseMetadata': {'RequestId': 'Q25RBRYKDP1G811B',
  'HostId': '...',
  'HTTPStatusCode': 200,
  'HTTPHeaders': {'x-amz-id-2': '...',
   'x-amz-request-id': '...',
   'date': 'Thu, 11 May 2023 18:29:16 GMT',
   'last-modified': 'Thu, 11 May 2023 02:40:22 GMT',
   'etag': '"..."',
   'x-amz-server-side-encryption': 'AES256',
   'accept-ranges': 'bytes',
   'content-type': 'application/javascript',
   'server': 'AmazonS3',
   'content-length': '969117'},
  'RetryAttempts': 1},
 'AcceptRanges': 'bytes',
 'LastModified': datetime.datetime(2023, 5, 11, 2, 40, 22, tzinfo=tzutc()),
 'ContentLength': 969117,
 'ETag': '"..."',
 'ContentType': 'application/javascript',
 'ServerSideEncryption': 'AES256',
 'Metadata': {},
 'Body': <botocore.response.StreamingBody at 0x7f8a07d96c90>}

In [18]: key
Out[18]: 'site-docs/develop/search-index.js'

But hitting the URL locally does NOT work even with a direct path and returns a 404.