Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Can I Use: Broaden search results by adding more aliases #172

Closed
jagtalon opened this issue Dec 26, 2015 · 10 comments
Closed

Can I Use: Broaden search results by adding more aliases #172

jagtalon opened this issue Dec 26, 2015 · 10 comments

Comments

@jagtalon
Copy link
Member

jagtalon commented Dec 26, 2015

Description

The "Can I Use" Instant Answer shows results for the search "can i use css animation", but not for "can i use css animations" or "can i use animations"

What to do

For each line in the articles.txt file, create aliases and store them in a new redirects.txt file, in the same directory.

Each line of the redirects.txt file should be structured as follows: alias,original line.
E.g: animations,css-animation

The aliases should have:

  • Plurals where appropriate (eg "animation" becomes "animations")
  • Symbols such as dashes replaced with spaces
  • Parentheses removed
  • The words "css" and "css3" removed

This change will allow the Instant Answer to trigger for more searches.


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

@meetmangukiya
Copy link

Would love to do it :D ? I've not been through the code though, might need some help, would it match the time/result productivity ratio of duckduckhack?, then assign me.

@moollaza
Copy link
Member

would it match the time/result productivity ratio of duckduckhack?

@meetmangukiya thanks for your interest -- we don't have any requirements regarding productivity -- we're just happy to have volunteers to help us out 👍

This isn't exactly a trivial fix though. This is a Fathead Instant Answer so the article titles "css animation" is pulled from www.caniuse.com

In order to support the plural, we need to create a redirect.

We could have a manually curated file that maps aliases/redirects for specific article titles, or we can try to achieve this programatically by, pluralizing words.

I suggest you take a look at the code to understand how this works and then we can determine a plan of action here 👍

@meetmangukiya
Copy link

the article titles "css animation" is pulled from www.caniuse.com

Then what is this file containing https://raw.githubusercontent.com/Fyrd/caniuse/master/fulldata-json/data-2.0.json ? I assumed it'd be the data which was used 😕

@moollaza
Copy link
Member

moollaza commented Sep 28, 2016

Then what is this file containing https://raw.githubusercontent.com/Fyrd/caniuse/master/fulldata-json/data-2.0.json ? I assumed it'd be the data which was used 😕

@meetmangukiya that's the JSON that Caniuse.com uses to build their site. We parse that (instead of scraping the website) to generate the Fathead.

However, we don't own that file and can't/shouldn't modify it for our purposes. You'll see that file is part of the Caniuse organization.

@altern8tif
Copy link

@moollaza is it advisable to manually curate the output.txt file to insert in redirects for certain triggers? Does DDG run the parser periodically to regenerate the output.txt file (or when someone clears cache)?

Doing it programmatically seems a bit of an overkill when the types of aliases (plurals or non-hyphenated words) may vary amongst the keys.

@moollaza
Copy link
Member

is it advisable to manually curate the output.txt file to insert in redirects for certain triggers?

@altern8tif yes that's totally fine. For the Perl Fathead, we've created a redirects.txt file, that the Parser uses to add in redirects to the output.txt file. We can't directly modify the output.txt because it needs to be reliably re-generated whenever needed.

Does DDG run the parser periodically to regenerate the output.txt file (or when someone clears cache)?

Currently no, we don't have them re-running at any set intervals. This is something we're considering. For now we've just been manually re-running the parsing scripts as needed, when the Fatheads become stale.

@MariagraziaAlastra MariagraziaAlastra changed the title Can I Use: Add other aliases for CSS animation Can I Use: Add more aliases Dec 1, 2016
@MariagraziaAlastra
Copy link
Member

@duckduckgo/duckduckhack-contributors Anyone wants to take this? We're experimenting with easier ways to add redirects for a Fathead 😄

@tagawa tagawa changed the title Can I Use: Add more aliases Can I Use: Broaden search results by adding more aliases Dec 2, 2016
@ppython
Copy link

ppython commented Dec 3, 2016

Neat idea!
What about a simple regex implementation?
Such as, based on original exemple animations,css-animation instead of having for aliases:

animations,css-animation
animation,css-animation
css-animations,css-animation

We could have something along the line of (pseudo definition for the idea)

/((css\s)?animation(s)?)+/g, css-animation

( quick test result http://regexr.com/3eq4j )

Too complicated? Riskier?
Or more compact?

@MariagraziaAlastra
Copy link
Member

MariagraziaAlastra commented Dec 5, 2016

@ppython You can definitely use regexes to generate redirects, but the redirects.txt file needs to have the specified format for now, or it won't work 😄
Thanks!

@pjhampton
Copy link
Contributor

Hey everyone

DuckDuckHack is now in Maintenance Mode and from now on, we are only accepting issues and PRs for essential bugs and bug fixes.

Unfortunately, with the above in mind, this isn't something we can action and will be closed.

We appreciate you taking the time to contribute and apologize for not being able to triage this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.