duckduckgo / zeroclickinfo-fathead

DuckDuckGo Instant Answers based on keyword data files
https://duckduckhack.com/
Other
318 stars 365 forks source link

MySQL: linebreaks `__NEWLINE__` and prefix 'mysql>' shown in example view #142

Closed ghost closed 7 years ago

ghost commented 9 years ago

When DDG-ing for mysql substring, the example view contains:

SUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len), SUBSTRING(str FROM pos FOR len):
mysql> SELECT SUBSTRING('Quadratically',5); -> 'ratically' __NEWLINE__mysql> SELECT SUBSTRING('foobarbar' FROM 4); -> 'barbar' __NEWLINE__mysql> SELECT SUBSTRING('Quadratically',5,6); -> 'ratica' __NEWLINE__mysql> SELECT SUBSTRING('Sakila', -3); -> 'ila' __NEWLINE__mysql> SELECT SUBSTRING('Sakila', -5, 3); -> 'aki' __NEWLINE__mysql> SELECT SUBSTRING('Sakila' FROM -4 FOR 2); -> 'ki'

It contains linebreaks __NEWLINE__ and prefix mysql>.

Instead, this would be much more readable:

SUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len), SUBSTRING(str FROM pos FOR len):

SELECT SUBSTRING('Quadratically',5); -> 'ratically'
SELECT SUBSTRING('foobarbar' FROM 4); -> 'barbar'
SELECT SUBSTRING('Quadratically',5,6); -> 'ratica'
SELECT SUBSTRING('Sakila', -3); -> 'ila'
SELECT SUBSTRING('Sakila', -5, 3); -> 'aki'
SELECT SUBSTRING('Sakila' FROM -4 FOR 2); -> 'ki'

IA Page: http://duck.co/ia/view/my_sql

moollaza commented 9 years ago

@fcturner thanks for reporting! I think someone should be able to update the parser for this Instant Answer so that it displays the result with newlines

moollaza commented 9 years ago

Crap, looks like this is an internal IA. We'll have to do it ourselves I guess.

@jdorweiler do you have any idea if we can open source this IA? Should we ask the community to re-implement it themselves?

jdorweiler commented 8 years ago

I think this is it. Unfortunatly, I don't think it's working. https://github.com/duckduckgo/zeroclickinfo-fathead/blob/master/lib/fathead/UNCLEAN/parse_mysqlfunction.py

pjhampton commented 7 years ago

Passing comments to internal team.