1 | # tymly-solr-plugin
|
2 | [![Tymly Package](https://img.shields.io/badge/tymly-package-blue.svg)](https://tymly.io/)
|
3 | [![npm (scoped)](https://img.shields.io/npm/v/@wmfs/tymly-solr-plugin.svg)](https://www.npmjs.com/package/@wmfs/tymly-solr-plugin)
|
4 | [![CircleCI](https://circleci.com/gh/wmfs/tymly-solr-plugin.svg?style=svg)](https://circleci.com/gh/wmfs/tymly-solr-plugin)
|
5 | [![codecov](https://codecov.io/gh/wmfs/tymly-solr-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/tymly-solr-plugin)
|
6 | [![CodeFactor](https://www.codefactor.io/repository/github/wmfs/tymly-solr-plugin/badge)](https://www.codefactor.io/repository/github/wmfs/tymly-solr-plugin)
|
7 | [![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/)
|
8 | [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
|
9 | [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
|
10 | [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/tymly-solr-plugin/blob/master/LICENSE)
|
11 |
|
12 | > This plugin handles interaction with Apache Solr.
|
13 |
|
14 | On tymly startup, this plugin searches the loaded blueprints for models that have properties which should be indexed by Apache Solr. It then creates a database view referencing those properties. This service also provides functions to instruct Apache Solr to index data from a database table/view.
|
15 |
|
16 | See the test blueprint in /test/fixtures/school-blueprint for an example of how to do this.
|
17 |
|
18 | ## <a name="install"></a>Install
|
19 | ```bash
|
20 | $ npm install tymly-solr-plugin --save
|
21 | ```
|
22 |
|
23 | ## <a name="test"></a>Testing
|
24 |
|
25 | Before running the tests, you'll need a test PostgreSQL database available and set a `PG_CONNECTION_STRING` environment variable to point to it, for example:
|
26 |
|
27 | ```PG_CONNECTION_STRING=postgres://postgres:postgres@localhost:5432/my_test_db```
|
28 |
|
29 | You can also set an optional `SOLR_URL` environment variable to configure what Apache Solr instance to use. If the environment variable is not set the plugin will default to `http://localhost:8983/solr`. You can however explicitly configure what instance to use like this:
|
30 |
|
31 | ```SOLR_URL=http://domain.com:8983/solr```
|
32 |
|
33 | Once the environment variables have been set, you can run the tests like this:
|
34 |
|
35 | ```bash
|
36 | $ npm test
|
37 | ```
|
38 |
|
39 |
|
40 | ## <a name="license"></a>License
|
41 |
|
42 | [MIT](https://github.com/wmfs/tymly/blob/master/LICENSE)
|
43 |
|
44 |
|