mozilla / universal-search

Completed Test Pilot experiment: add-on that inserts server recommendations into the Awesome Bar
https://wiki.mozilla.org/Test_Pilot/Universal_Search
Mozilla Public License 2.0
29 stars 16 forks source link

Only show recommendations for predefined result types. #165

Closed chuckharmston closed 8 years ago

chuckharmston commented 8 years ago

Blocked on https://github.com/mozilla/universal-search-recommendation/issues/117

jaredhirsch commented 8 years ago

@chuckharmston As far as I can tell, the only thing that varies between the TLD and Wikipedia row types is the name of the key used to get the same information (like enhancements.wikipedia.title vs result.title). Why not just have the Recommendation pass a config object into the RecommendationRow constructor, something like

let rowConfig;
if (type === 'wikipedia') {
  rowConfig = {
    title: result._get('enhancements.wikipedia.title'),
    url: result._get('enhancements.wikipedia.url'),
    type: 'wikipedia'
  };
} else {
  rowConfig = {
    title: result._get('result.title'),
    url: result._get('result.url'),
    type: 'tld'
  };
}
const recommendation = new this.RecommendationRow({
  eTLD: this.eTLD,
  io: this.io,
  win: this.win,
  config: rowConfig
});

Since the two types are visually identical, I think this simpler approach would be better. (Even if we do start styling the two types differently, we can use the type as a classname to toggle styling changes.) We're about a week out from public launch, and I'd like to minimize code changes.

chuckharmston commented 8 years ago

Why not...

Because the immediate post-launch roadmap has us doing some radically different things (i.e. movie recommendations); I tried to build this with that in mind. I've been especially sensitive to introducing technical debt, since it's not terribly clear who will be working on this in the near future. I'd prefer to hand this off with as few shortcuts as possible, even though the entire thing is a hack.

But your point is good; if you feel strongly, feel free to r- and close the pull request (this is the issue) and I'll give it another try tomorrow.

jaredhirsch commented 8 years ago

Because the immediate post-launch roadmap has us doing some radically different things

Yeah, I'd say, let's stash this in a branch for now, and revisit when we are in a sprint planning meeting and different card types come up.

This close to launch, I'd prefer to focus on the bugs that were already filed and labeled launch blockers as part of our planning session. So, I'm going to remove the 'public launch' label from this, but we'll revisit as soon as it makes product sense.

chuckharmston commented 8 years ago

Sorry, I guess I'm confused at what you mean. Are you wontfixing this bug, or #166?

jaredhirsch commented 8 years ago

If the server is only going to send over predefined result types (in that blocking bug, https://github.com/mozilla/universal-search-recommendation/issues/117), then there's nothing we have to do in the add-on before public launch. The add-on can just naively display whatever the server sends over.

chuckharmston commented 8 years ago

That's not really true; right now we do some moderately complex negotiating (example) of data sources that mixes what we would now consider "tld" or "wikipedia" results. The different data sources we're using also have different pieces available—we're able to know a defined size of images coming from Clearbit, but we have to pass the width and height of images coming from Embedly so the UI can do display-related calculations.

That's also not how the server works; remember that we're trying to keep all of the logic on the client side to make UI experimentation easier. We don't just pick "an image" to send as "the image"; we augment the result with as many relevant bits as we can, and let the addon negotiate the best way to display them. Even if we were to change that—which I would not recommend—the addon would need to be changed to accomodate that.

nchapman commented 8 years ago

So, I'm going to remove the 'public launch' label from this, but we'll revisit as soon as it makes product sense.

Sorry again don't know all the technical implementation details here, but it's important for the public launch that we limit the types of results and report on those types in our metrics. It seems like this is the implementation of those limits. Let me know if it would help for us to have a quick triage/chat to sort out the specifics.

jaredhirsch commented 8 years ago

@chuckharmston @nchapman Sounds like a meeting is in order

jaredhirsch commented 8 years ago

@chuckharmston @nchapman Sounds like a meeting is in order

Actually, maybe not.

@nchapman If limiting the types of results to TLD and Wikipedia, and reporting on which was shown/clicked in metrics code, is all that's needed from a product perspective, that's a crisp enough definition for me, provided that we do basically the same thing with clearbit vs embedly images in both cases.

@chuckharmston I'd like to find the simplest solution here that meets the product's needs. Suppose we add the 'tld' or 'wikipedia' classname to the existing recommendation, and change nothing else. What would be broken / missing?

jaredhirsch commented 8 years ago

Chuck and I discussed this at length. The old and new APIs are documented via examples here: https://gist.github.com/chuckharmston/861a1442e7dde98aefe333a2347e0361

Major changes:

TLD type:

Wikipedia type:

chuckharmston commented 8 years ago

Good test cases: