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
Combine text and page index #27
Conversation
@@ -8,7 +8,7 @@ | |||
|
|||
HTML_MIME_TYPES = ("text/html", "application/xhtml", "application/xhtml+xml") | |||
|
|||
PAGE_INDEX = "text/pages.pdx" | |||
PAGE_INDEX = "text/pages.jsonl" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the directory to be pages/pages.jsonl
{"url": "https://example.com/", "title": "Example Domain": "text": "Example Domain\nThis domain is for..."} | ||
{"url": "https://example.com/another", "title": "Another Example", "text": "Some other text for this page..."} | ||
{"id": 0, "url": "https://example.com/", "title": "Example Domain": "text": "Example Domain\nThis domain is for..."} | ||
{"id": 1, "url": "https://example.com/another", "title": "Another Example", "text": "Some other text for this page..."} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change examples to random id to match the new uuid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UUID? This is nice! We sometimes use UUID V5 when we want to have a repeatable/always the same UUID based on a certain seed https://docs.python.org/3/library/uuid.html#uuid.uuid5 . By passing as first argument the constant uuid.NAMESPACE_URL
and then your current "url" value as the second argument you get that. Does not change the actual string/sequence/pattern but allows you to always get a consistent, same UUID string when using the URL as seed, so maybe a future idea. Or also, just a comment you can totally dismiss because it may add processing time! and on a huge list that adds up! :) Happy you went this route. Good night!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that's an interesting idea, and tempting, but probably not a good idea, as this would imply that a URL or URL + TS are fully unique, which we can't guarantee. For example, we could have two captures of the same URL at same time that are different (different cookies, different locations, etc..), and this would imply that they're fixed.
Having a generic id string is also more flexible, as can import from systems that already have a page ID.
Maybe we should make it clear that the id is just a unique string, we're using uuid but it doesn't have to be that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally! Makes sense, I thought URL were unique but of course they do not need to be like that. Thanks!!
py-wacz/wacz/waczindexer.py
Outdated
if title: | ||
data["title"] = title | ||
|
||
if "text" in line: | ||
data["text"] = line["text"] | ||
|
||
yield json.dumps(data) + "\n" | ||
id += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed since its a uuid
Supports https://github.com/webrecorder/wacz-format/issues/25