TREC Microblog 2014 Go Bindings An alternative to lots of Java

The TREC Microblog Track is, for the second year running, using a unique “evaluation as a service” model. I decided I’d invest a little bit of time and create a Go library for those of us who use Go and take part in the track (which I imagine is probably only me).

Getting Started

Before you can use the library, you’ll need to download and install the Thrift library for Go. Ofcourse, because it’s Go, the go get command can deal with that for us:

go get

You can find the library on the MIR Git server, or to get started quickly, use the go get command to install the library:

go get

Basic Example

The library is modelled loosely on the official Microblog track client, which is written in Java. It’s very simple and implements 3 basic actions: 1) Create a connection 2) Perform a query and return results and 3) Close the connection. All of these are demonstrated in the example below.


package main

import (

func main() {
	// Create a new client using the settings in conf.json
	client, err := twittertools.NewClientFromConf("conf.json")
	if err != nil {
	defer client.Close()

	// query the server for "glasgow", retreive the top 50 results
	// -1 signifies that there is no maximum tweet ID
	results, err := client.Search("Glasgow", 50, -1)
	if err != nil {

	// Iterate over the results, printing text from each tweet
	for k, result := range results {
		fmt.Println(k, result.Text)

The example uses a conf.json file (example below) to load the server details and your team details. If you’d rather hard-code the values, the twittertools.NewClientFromDetails(host, port, group, token) function allows you to create a new client and specify the details manually.

These details are unique to your team and should have been provided when you registered for TREC. If you haven’t already registered, there’s always next year!


  "Host":  "",
  "Port":  9091,
  "Group": "UrTeamName",
  "Token": "de4db33f"

A. J. McMinn


5th of August, 2014