Skip to content
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

Handle source: metatag when editing posts #2664

Closed
evazion opened this issue Sep 9, 2016 · 4 comments
Closed

Handle source: metatag when editing posts #2664

evazion opened this issue Sep 9, 2016 · 4 comments

Comments

@evazion
Copy link
Member

evazion commented Sep 9, 2016

Currently every metatag except source: is supported when editing a post. This is needed for adding sources via tag scripting as described here: http://danbooru.donmai.us/forum_topics/9127?page=131#forum_post_118649.

(Note to self: apply fixes here and here)

@Type-kun
Copy link
Collaborator

It wouldn't handle spaces properly, though. It's possible to make special exception in Tag.scan_tags, for example extracting source:"text with spaces here" first before breaking the rest on whitespace, but then it wouldn't handle double quotes.

@evazion
Copy link
Member Author

evazion commented Sep 18, 2016

source: doesn't handle spaces properly when searching either. So we already can't handle things like source:Image board or source:*Kantai Collection*. The best you can do is abuse wildcards: source:Image*board, source:*Kantai*Collection*.

Also there's no way to search for a literal source of none or literal * characters. Such posts do exist, although only a small number.

I think the options are:

  • Fix Tags.parse_query to allow source:"*Kantai Collection*". But that doesn't look easy.
  • URL decode the source string. So to search *Kantai Collection* you'd say source:*Kantai%20Collection*. But that's not easy to use.
  • Only allow URLs in the source. If the source is a doujin or something then put it in a pool instead of putting the title in the source.
  • Don't worry about all this, just leave it as is.

@Type-kun
Copy link
Collaborator

Took a stab at the hardest version. Searching for source:"*Kantai Collection*" results in the following where condition:

(SourcePattern(lower(posts.source)) 
LIKE SourcePattern(lower('%Kantai Collection%')) ESCAPE E'\\')

That is, spaces are handled correctly, and asterisks are allowed within double quotes too. Seems pretty decent unless it broke something else. It doesn't fix searching for literal none or * - I think it's possible to fix, too, but it requires changes in other places.

@Type-kun
Copy link
Collaborator

Fixed with the merged PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants