Add services providing statistics about search and catalog content (retu...


Those service allows user to build client application displaying statistics about:
 * search
 * catalog content

2 families of services are defined

## Search statistics
  
### Service statistics-search

Return main metrics for the catalog and search service. Metrics are:
 * activity_days: Number of days of activity
 * activity_months: Number of months of activity
 * total_searches: Total number of searches
 * avg_searches_by_day: Average number of searches by day
 * avg_searches_by_month: Average number of searches by month
 * avg_views_by_day: Average number of metadata record views by day
 * avg_views_by_month: Average number of metadata record views by month
 * total_searches_with_no_hits: Number of searches with no hits


Parameters: 
 * service: the search service to compute statistics on (eg. service=csw)

URL: http://localhost:8080/geonetwork/srv/eng/statistics-search?service=q

Response:
```
<response>
  <activity_days>48</activity_days>
  <activity_months>1</activity_months>
  <total_searches>31</total_searches>
  <avg_searches_by_day>0</avg_searches_by_day>
  <avg_searches_by_month>31</avg_searches_by_month>
  <avg_views_by_day>4</avg_views_by_day>
  <avg_views_by_month>219</avg_views_by_month>
  <total_searches_with_no_hits>0</total_searches_with_no_hits>
</response>
```

### Service statistics-search-ip

Return unique IP address with number of searches.

URL: http://localhost:8080/geonetwork/srv/eng/statistics-search-ip

Response:
```
<response>
  <record>
    <ip>127.0.0.1</ip>
    <sumhit>1058</sumhit>
  </record>
</response>
```


### Service statistics-search-by-service-type

Return number of searches per service types.

URL: http://localhost:8080/geonetwork/srv/eng/statistics-search-by-service-type

Response:
```
<response>
 <record>
    <service>q</service>
    <nbsearch>971</nbsearch>
  </record>
  <record>
    <service>csw</service>
    <nbsearch>31</nbsearch>
  </record>
</response/
```

### Service statistics-search-fields

Return information about which search fields are used by service type.

URL: http://localhost:8080/geonetwork/srv/eng/statistics-search-fields


Response:
```
<response>
  <record>
    <service>csw</service>
    <termfield>keyword</termfield>
    <total>17</total>
  </record> 
  <record>
    <service>csw</service>
    <termfield>any</termfield>
    <total>6</total>
  </record>
...
```

### Service statistics-search-terms

Return information about which search terms are used for a field.

URL: http://localhost:8080/geonetwork/srv/eng/statistics-search-terms?field=any&service=q

Parameters: 
 * field: Lucene search field (eg. field=any)
 * service: the search service to compute statistics on (eg. service=csw)

Response:
```
<response>
  <record>
    <termtext>africa</termtext>
    <total>6</total>
  </record>
</response>
```




## Catalog content statistics

### Service statistics-content

Return information about the number of metadata records in the catalog:
 * nb_metadata: Total number of records
 * nb_harvested: Number of harvested records
 * nb_template: Number of templates
 * nb_subtemplate: Number of directory entries
 * nb_metadata_public: Number of public metadata records


URL: http://localhost:8080/geonetwork/srv/eng/statistics-content

Response:
```
<response>
  <nb_metadata>106</nb_metadata>
  <nb_harvested>59</nb_harvested>
  <nb_template>11</nb_template>
  <nb_subtemplate>2</nb_subtemplate>
  <nb_metadata_public>0</nb_metadata_public>
</response>
```


### Service statistics-content-metadata

Return statistics by type of records.

Parameters:
 * by: Type of records
  * schema: By metadata standards
  * category: By category
  * template: By metadata type
  * harvest: Harvested or not
  * source: By source catalog
  * status: By metadata status
  * validity: By metadata validation status
  * owner: By owner
  * groupowner: By group owner
 * isTemplate: To return information for template (ie. "y"), metadata (ie "n"), directory entry (ie. "s") or all "%"


URL: http://localhost:8080/geonetwork/srv/eng/statistics-content-metadata?by=schema&isTemplate=n

Response: 
```
<response>
    <record>
        <label>iso19139</label>
        <total>97</total>
    </record>
    <record>
        <label>dublin-core</label>
        <total>3</total>
    </record>
    <record>
        <label>fgdc-std</label>
        <total>3</total>
    </record>
    <record>
        <label>iso19115</label>
        <total>3</total>
    </record>
</response>
```



## Sample user interface using those services (not part of this proposal)


![geonetwork-dashboard-statistics-content](https://f.cloud.github.com/assets/1701393/917284/60566096-fea1-11e2-959b-3307c249a67c.png)
![geonetwork- dashboard-statistics-search](https://f.cloud.github.com/assets/1701393/917285/605d4276-fea1-11e2-9006-6ef5f7bdb09d.png)