September 1, 2015 | Written by: Frederic Lavigne
Share this post:
As I was working on SOmusic, I experimented with the Insights for Twitter test application provided to define the queries I would be using and to understand the result format:
It got the job done, but as I was going back and forth in the documentation of the query language, I thought we could have a more complete search user interface. Step 1 of my solution is shown below:
The interface uses the impressive jQuery QueryBuilder plugin to visually assemble the query. The experts can directly use the “Raw Query” field type but the uninitiated can pick fields from the list. Each field has a description you can display by pressing the blue “i” button. The plugin supports creating nested queries so that you can build more complex searches combining AND/OR groups.
Once the query is defined, use the Twitter Search button to get a subset of the results:
Of course you can deploy the app in your own Bluemix account and tweak the code if you want to get more results here. Step 3 shows the tweets:
Select a tweet to view its details in Step 4; this uses the Twitter oEmbed API:
In both steps 3 and 4, you can switch to the Source tab to view the raw JSON data. Step 5 in the UI shows the Insights for Twitter enrichments. You can query these fields in the search, making this a great way to tailor the results to your needs:
In Step 6, you can copy a link that embeds the query definition, so that you can pass it to a friend or bookmark it:
For sake of completeness, below is a full screenshot showing the 1-6 steps above (click to enlarge):
The source code is posted at IBM-Bluemix/insights-search on GitHub. A sample version is deployed at insights-search.mybluemix.net but you can use the Deploy button below to deploy it to your own Bluemix account:
If you have comments on the user interface or would like to suggest improvements, please reply below!