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

$this->formatQueryParams() in TwitterSearch causes incorrect search filter #3

Closed
Gnative opened this issue Nov 30, 2015 · 1 comment

Comments

@Gnative
Copy link

Gnative commented Nov 30, 2015

If I pass a ['q'=>'dogs'] as queryParams to the constructor. The function formatQueryParams() turns this into q:dogs. Which is what is search for and returns tweets with content such as "Q Dogs".
I get better return results by using below.

$this->queryParams['count'] = $count;
$body = $this->twitterConnection->get("search/tweets", $this->queryParams );

Thou I'm not sure if this is correct either.

@ambroisemaupate
Copy link
Member

@Gnative I’m currently fixing this. You should not have to pass a ['q'=>'dogs'] parameter array as TwitterSearchFeed automatically adds the q param.

$body = $this->twitterConnection->get("search/tweets", [
      "q" => $this->formatQueryParams(),
      "count" => $count,
]);

After I’ll fix the formatQueryParams method, you’ll be able to use a multikey array:

   new TwitterSearchFeed(
        [
            'twitter', // do not specify a key for string searchs
            'from' => 'ambroisemaupate',
            'since' => '2015-11-01',
            'until' => date('Y-m-d'),
        ],
        'xxxx',
        'xxxx',
        'xxxx',
        'xxxx',
        $cache
    ),

It will generate the q param with "twitter from:ambroisemaupate since:2015-11-01 until:2015-12-01" value. It’s the right syntax according to https://dev.twitter.com/rest/public/search

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