examples package: Solr search indices
Search indices play a vital role in Martini. Tracker uses Apache Solr to index service payloads, and the invoke monitor can use Solr to log service invokes, which can then be used to compute invocation costs. Aside from these, custom search indices can be created and linked to your packages to store and index additional data1 so that you may use them in your applications, or to create reports. Martini also includes the APIs necessary to store and search for data from a search index.
examples package shows how you can use
one-liners from the
SolrMethods class and
HTTP client services to index and/or query data from a
custom search index, the Tracker search index, or the
invoke monitor search index. Example services are written in
Gloop and can be found under the
solr code directory.
These services are more thoroughly discussed in these sections:
Tracker and invoke monitor services
The following services below are present both in the
and demonstrate how to query the Tracker and invoke monitor search indices, respectively.
||Queries the Solr index and generates a facet count.|
||Lists all the terms under the specified facet field.|
||Queries the Solr index and generates a table summarizing the results.|
||Queries the Solr index and generates statistics.|
||Similar to the List Face Count API, but limits to a single facet field.|
||Similar to List Statistics API, but limits to a single facet field.|
||Uses range faceting on a date field or a numeric field that supports ranged queries.|
||Demonstrates the use of the Martini's extended Solr API.|
Sending Solr queries from Gloop
Custom search index services
The following services under
solr.customSolrCore demonstrate how to add and query documents from
custom search indices:
||Adds a new document to the custom Solr movie core.|
||Queries the custom Solr movie core index.|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
examples ├── ... └── code └── solr ├── config │ ├── CreateAdminUser.gloop │ └── DeleteAdminUser.gloop ├── customMonitorSearch │ ├── GetFacetCountEndpoint.gloop │ ├── GetStatisticsEndpoint.gloop │ ├── ListFacetCountEndpoint.gloop │ ├── ListFacetTermsEndpoint.gloop │ ├── ListPivotFacetEndpoint.gloop │ ├── ListStatisticsEndpoint.gloop │ ├── RangeFacetEndpoint.gloop │ └── RequestHandlerEndpoint.gloop ├── customSolrCore │ ├── MovieIndexer.gloop │ ├── MovieSearcher.gloop │ └── MovieSolrAPI.groovy └── customTrackerSearch ├── GetFacetCountEndpoint.gloop ├── GetStatisticsEndpoint.gloop ├── ListFacetCountEndpoint.gloop ├── ListFacetTermsEndpoint.gloop ├── ListPivotFacetEndpoint.gloop ├── ListStatisticsEndpoint.gloop ├── RangeFacetEndpoint.gloop └── RequestHandlerEndpoint.gloop
Open and run any of the services under
solr.customTrackerSearch to inspect their contents and observe how they work. Every service has been decorated
with comments2 so you can easily tell how to invoke it, what output to expect, and the purpose of each of its steps.
The example services that query the Monitor and Tracker search indices use HTTP client services to direct the queries to the Solr server. The response received by the Gloop service will then be converted to a Gloop model.
You can query custom Solr indices using HTTP calls, too!
All search indices can be managed using Martini's extended Solr Search API.