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

GHSearchBuilder terms are cumulative when I expected them to overwrite previous one #314

Closed
davidxia opened this issue Nov 25, 2016 · 2 comments

Comments

@davidxia
Copy link
Contributor

davidxia commented Nov 25, 2016

This isn't a huge deal, but I thought I'd point out something I didn't expect as a user.

I thought that if I reused GHContentSearchBuilder which extends GHSearchBuilder, it's repo() method would overwrite previous calls of repo(). I was confused when my search results from the second call below was the same as the first.

final GHContentSearchBuilder searcher;
searcher.repo("foo").q("query1").list(); // terms are repo:foo, query1
searcher.repo("bar").q("query2").list(); // terms are repo:foo, query1, repo:bar, query2

The reason is because calling repo() (and other methods like in(), etc) add terms instead of overwriting previous ones. See above comments.

Consider overwriting as that seems more intuitive?

@kohsuke
Copy link
Collaborator

kohsuke commented Nov 26, 2016

You'd expect search.q("foo").q("bar").list() to search "foo" and "bar", so I'm not sure if the overwriting is expected. Perhaps your point is more about making list() reset the terms?

Between the backward compatibility & obvious "work around", I'm not going to change this.

@kohsuke kohsuke closed this as completed Nov 26, 2016
@davidxia
Copy link
Contributor Author

davidxia commented Nov 26, 2016 via email

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