Searches using operator "from" and "to" for the parameter "q" doesn't work

android

#1

Hi,

I’m trying to do a search on Android using this kit:
https://dev.twitter.com/twitter-kit/android/show-timelines

I need to search tweets generated in an account and led to other account, then I tried to search using operators “from” and “to” for “q” parameter, but always returned empty results although here I see that if there are results: https://twitter.com/search?f=realtime&q=from%3Aingdeoz%20to%3APlantaParlante&src=typd .

As a test, I realized the “#plantaparlante” query and displays the results correctly, but I need to use operators “from” and “to”. Commented lines are some failed tests.

My code is:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pantalla_consultas);

        config_global = ((ConfigGlobal)getApplicationContext());

        // String qry = "from:" + config_global.getScreenNameDueno() + "%20to%3A" + config_global.getScreenNamePlanta();
    // String qry = "from:" + config_global.getScreenNameDueno();
    // String qry = "from: ingdeoz";
    // String qry = "from:ingdeoz";
    // String qry = "from:" + config_global.getScreenNameDueno() + "%20to%3A" + config_global.getScreenNamePlanta();
    // String qry = "from:" + config_global.getScreenNameDueno() + "+to:" + config_global.getScreenNamePlanta();
    // String qry = "q=from%3Aingdeoz%2C%20to%3APlantaParlante";
    // String qry = "from%3Aingdeoz%2C%20to%3APlantaParlante";
    // String qry = "from%3Aingdeoz";
    // String qry = "from:ingdeoz+to:PlantaParlante";
    // String qry = "from%3Aingdeoz";

        String qry = "#plantaparlante";
        Log.i("myTag", "query: " + qry);

        final SearchTimeline searchTimeline = new SearchTimeline.Builder()
                .query(qry)
                .build();

        final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter(this, searchTimeline);
        setListAdapter(adapter);
    }

XML:

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <TextView android:id="@id/android:empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal|center_vertical"
        android:text="@string/timeline_empty"/>

    <ListView android:id="@id/android:list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:divider="@color/divider_gray"
        android:dividerHeight="@dimen/divider_height"
        android:drawSelectorOnTop="false"/>
</LinearLayout>

Thanks for help


#2

Add a space to the end of your search query. If you check the network call being made, you’ll see we internally append a few parameters to the query, which requires space separation when from: and to: are used.

This is a bug which will be fixed in the next version so that you don’t need the space (but having it won’t be a problem either). Sorry about that.


#3