How to use Search History in VersionPress

Overview on using the Search History function in the VersionPress plugin

The searching function has been added to VersionPress 3.0 and uses syntax close to the one of GitHub itself.

 

With the Search function you can find specific changes that have the words provided for the search by you. Let us say the default post of WordPress – Hello World has been changed and you wish to find that change. In this case you can use:

 

hello world

 

You can also add operators like author: or date: for more precise searching results:

 

hello world author: john* date:">= 2016-05-20"

 

The operator author: for example is the one initiating the action.

There are two special authors:

  • author:nonadmin@example.com finds anonymous actions like posting a comment on a blog.
  • author:wp-cli finds actions done via WP-CLI.

 

date:

The recommended format when using dates is YYYY-MM-DD. You can use greater than / less than operators such as
 

date: >=2016-01-01

 

or a range operator .., for example

 

date: 2016-01-01..2016-02-01

 

Either boundary can be replaced with a wildcard:

 

2016-01-01..*

 

However, the date: operator has some limitations like ignoring time portions, issues with using the operator repeatedly instead of one at a time, and inability to search for a data periods with a gap in between.

 

entity:, action:, vpid:

 

Every action recorded by Version press has been done by an entity (post, user, option, postmeta etc.). Each entity has a unique ID, for example: 25RTD7641H06B319S623E32FG1BB97C. You can search for these IDs by using entity or action.

 

arbitrary-vp-tag:

 

VP tags are parts of metadata that VersionPress stores with each commit. For example, updating the site title creates a commit message like this:

 

[VP] Edited option 'blogname'

 

VP-Action: option/edit/blogname

 

X-VP-Version: 3.0

X-VP-Environment: staging

You can search for VP tags, in their full form or without the VP- / X-VP- prefix. Some examples that will also work with the example above are:

 

  • environment: staging
  • X-VP-Environment: staging
  • VP-environment: STAGING
  • action: option/edit/blogname
  • VP-Action: option/edit/*
  • Action: */edit/*
  • vp-version: 3.0

 

One of the other limitations to the search function is the inability to work with negative statements. For example:

 

author: not john

 

will not provide information for posts written by other authors excluding john.