ellipses

. ...

Persistent URLs in Ajax-solr

The ajax-solr library is a great starting point for using Solr directly via the rest interface. There are various widgets and managers for storing state, and to ensure that back/forward work correctly on the browser.

For a part of a current project, we wanted to have the ability to share urls and the simplest thing to enable seemed to be the ParameterHashStore which uses the stored paramenters in the ParameterStore. To get this fully working I had to make the following changes.

Ensure the stores are referenced in reuters.js:

'core/ParameterStore',
'core/ParameterHashStore',

Set the manager to use the ParameterHashStore.

Manager.setStore(new AjaxSolr.ParameterHashStore());

And a condition to add a default query as the search was being called from an external page which may or may not set the search criteria.

var param = Manager.widgets.currentsearch.manager.store.params['q'];
if (!param)
{
  Manager.store.addByValue('q', '*:*');
}

In ParameterHashStore.js, the init function that sets up the event handlers didn’t seem to work in my configuration (this.exposed was always empty):

init: function () {
  if (this.exposed.length) {

The if condition was removed to ensure the events were always initialised.

Unfortunately, this worked only for the query string, rather than facets, page number, or another parameters, which are required if sharing the url, so I modified the the exposedString() method in ParameterStore.js.

exposedString: function () {
  var params = [], string;
  for (var i = 0, l = this.exposed.length; i < l; i++) {
    if (this.params[this.exposed[i]] !== undefined) {
      if (this.isMultiple(this.exposed[i])) {
        for (var j = 0, m = this.params[this.exposed[i]].length; j < m; j++) {
          string = this.params[this.exposed[i]][j].string();
          if (string) {
            params.push(string);
          }
        }
      }
      else {
        string = this.params[this.exposed[i]].string();
        if (string) {
          params.push(string);
        }
      }
    }
  }
  return params.join('&');
}

This was changed to (added reference to underscore.js):

exposedString: function() {
  var paramToString = function(param){
    if (param.name) return param.string();
    return _.map(param, paramToString);
  };

  return _.flatten(
    _.map(this.params, paramToString)).join('&');
}

This ensures that all the parameters are exposed, and will update window.location. The hash/url is now consistent with the selected facets and search query, and so far it seems to work OK.

Austerity Measures

Austerity measures for businesses are something I find confusing. From a person looking outside in, they appear to make sense, a VP says, “our company now spends 75% less on ‘non-essential’ activities, such as Christmas parties”. From the inside out, you have to wonder why the money was ever spent in the first place.

The reason for the activity is that the investment was evaluated and determined to have outcomes that were worth the investment, supported by a business case. So what happens when austerity measures are introduced and how are the effects of divestment measured and evaluated? I would suggest that austerity measures are generally a harmful anti-pattern1, and that the impacts are not often fully understood.

I would also argue that once austerity measures are in place, it’s difficult to restore the culture of the business or organisation which may have existed before the measures. However, if the decision means that a business can remain operating verses failing, austerity measures may be the only solution.

Here is one example:-

Paper and pens

The stationary cupboard will be locked, and an employee has to prove they need the item by showing the previous full notepad or empty pen.

Cost saving: Small

Reasoning:

” … employees attending meetings forget their notepad, and take another. Leaving them with multiple half-empty notepads. This is wasteful …”

What is meant to happen: Employees will remember to bring their notepads to meetings, and will ensure they use every page of every notepad they are given. Also, the environment will benefit from a reduction in wasteful paper use.

What will happen: Employees may not be able to take notes or ideas in meetings, they will spend time firstly trying to find, and then asking others for paper and pens.

There is also something more subtle that could be happening, and that is the reason why the notepad was forgotten, there could be many reasons, but one could be that the person is consumed with their value-adding task, and simply forgot their notepad.

Perhaps more importantly, how does this make the employee feel if they have to ask for a basic work commodity? It’s certainly going to distract them from the activity, and having to ask interrupts someone else from their activity. This has now cost the time of at least two employees who could have been doing a value-adding activity. Perhaps, in having to ask the person may feel a sense of failure (at having forgotten their notepad) and a decreased feeling of self-worth (and morale).

The attempt to drive behaviour change by removing someone’s free choice can lead to motivational responses, such as reactance:

“When certain free behaviours are threatened or removed, the more important a free behaviour is to a certain individual the greater the magnitude of the reactance.”2

This can have a stronger deleterious effect than the initial problem …

Alternative solution: Provide paper in meeting rooms. Ensure it’s compatible with other notepads provided. Person can forget their notepad, and still have a productive meeting (and be able to compile their notes afterwards).

Decision Making and Waste

I read the following statement following a user feedback review for a service. It was the simple suggestion to keep search text in a box between searches. It doesn’t currently, and feedback suggests that it should.

“Action: [analyst] to confirm with [change team] that this change in behaviour would be an easy one to make and to ensure that the change has no other implications. If this is confirmed, [analyst] will ask [the marketing team] to consult with [user group] to get their user opinions on the change before we make a final decision [on making the change or not]”

Here’s a diagram of the individuals and interactions involved in only the decision making part of the change.

Individuals and interactions

Spot the waste.

Solution

  1. Make the change (it’s obviously simple)
  2. Make the behaviour optional for the user (and globally configurable)
  3. Monitor feedback

Raspberry Pi Search Server

The launch of the Raspberry Pi had me and Steve Hine thinking about what we could do with a cheap PC on a chip style device – especially if we had a few of them.

The idea:

  1. Acquire a number of Raspberry Pis (as many as we can get our hands on), we’ll need the Model Bs as we need the ethernet support.
  2. Use a Fox’s biscuit tin or suitable housing to house them
  3. Use lego, or technical lego to secure them
  4. Use 20v multi-adapter to power 5v the devices
  5. Use SD cards (probably 16GB), to store data
  6. Use a -1Gb- 100Mb switch or hub ideally powered by 5v, with CAT 6e cabling to connect them

From the FAQ: “The Raspberry Pi measures 85.60mm x 53.98mm x 17mm, with a little overlap for the SD card and connectors which project over the edges. It weighs 45g.”

PiServer diagram

How a PiServer may look, if it were made of construction paper

Upon this behemoth, we will configure Solr instances to shard a large-ish set of search data - probably the ~300k documents we have available on NHS Evidence.

We will then benchmark this against the rather powerful servers we have at Rackspace to compare search performance.

Following that, we will open a Raspberry Pi hosting company running from Fox’s biscuit tins called RaspberryFoxR, and enjoy a life of tinkering with VERY small linux devices.

Colleague Red Flags

Fun things colleagues do that damages my calm.

  • inability to touch type
  • pasting screenshots into word