com.englishtown.vertx:vertx-solr-service

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

GroupId

GroupId

com.englishtown.vertx
ArtifactId

ArtifactId

vertx-solr-service
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Project URL

Project URL

https://github.com/englishtown/vertx-solr-service
Project Organization

Project Organization

Englishtown
Source Code Management

Source Code Management

https://github.com/englishtown/vertx-solr-service

Download vertx-solr-service

How to add to project

<!-- https://jarcasting.com/artifacts/com.englishtown.vertx/vertx-solr-service/ -->
<dependency>
    <groupId>com.englishtown.vertx</groupId>
    <artifactId>vertx-solr-service</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.englishtown.vertx/vertx-solr-service/
implementation 'com.englishtown.vertx:vertx-solr-service:2.1.0'
// https://jarcasting.com/artifacts/com.englishtown.vertx/vertx-solr-service/
implementation ("com.englishtown.vertx:vertx-solr-service:2.1.0")
'com.englishtown.vertx:vertx-solr-service:jar:2.1.0'
<dependency org="com.englishtown.vertx" name="vertx-solr-service" rev="2.1.0">
  <artifact name="vertx-solr-service" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.englishtown.vertx', module='vertx-solr-service', version='2.1.0')
)
libraryDependencies += "com.englishtown.vertx" % "vertx-solr-service" % "2.1.0"
[com.englishtown.vertx/vertx-solr-service "2.1.0"]

Dependencies

compile (6)

Group / Artifact Type Version
org.apache.solr : solr-solrj jar 5.2.1
com.englishtown.vertx : vertx-hk2 jar 2.1.0
io.vertx : vertx-service-proxy jar 3.1.0
io.vertx : vertx-codegen Optional jar 3.1.0
io.vertx : vertx-lang-js Optional jar 3.1.0
io.vertx : vertx-core jar 3.1.0

test (4)

Group / Artifact Type Version
org.mockito : mockito-core jar 1.10.19
io.vertx : vertx-service-factory jar 3.1.0
junit : junit jar 4.12
io.vertx : vertx-core test-jar 3.1.0

Project Modules

There are no modules declared in this project.

Vert.x Solr Service

Vert.x 3 solr service with event bus proxying.

Build Status Maven Central

TODO: Update the documents for vert.x 3 service proxying.

##Configuration

The configuration options are as follows:

{
    "hk2_binder" : <hk2_binder>,
    "client_type": <client_type>,
    "server_url": <server_url>
}
  • hk2_binder - The fully qualified path name of your hk2_binder.
  • client_type - The type of vert.x Solr client, default is DefaultVertxSolrClient
  • server_url - The url to your Solr installation.

An an example configuration would be:

{
    "hk2_binder": "com.englishtown.vertx.solr.hk2.SolrBinder",
    "server_url": "http://localhost:8983/solr"
}

The SolrVerticle requires a SolrQuerySerializer to be injected. A DefaultSolrQuerySerializer has been provided which handles serialization/deserialization of json.

The default binding provided is for HK2, but you can create a guice module if that is your container of choice.

Dependency Injection and the HK2VerticleFactory

There are two ways to enable DI:

  1. In the vert.x.langs.properties set the java value to: java=com.englishtownvert-mod-hk21.7.0:com.englishtown.vertx.hk2.HK2VerticleFactor
  2. Pass a system property at startup like this: -Dvertx.langs.java=com.englishtownvertx-mod-hk21.7.0:com.englishtown.vertx.hk2.HK2VerticleFactory

See the englishtown/vertx-mod-hk2 project for more details.

Action Commands

Query

Standard Solr query parameters are supported. In the below example, the "q", "start" and "rows" parameters are used. See the Solr CommonQueryParameters Wiki for query construction details.

The service replies with a json result with the following structure:

{
    "responseHeader": {
        "status": 0,
        "QTime": 1
    }
    "response": {
        "numFound": <number_found>,
        "start": <start>,
        "docs": [<docs>]
    }
}
  • number_found - The total number of results found.
  • start - The starting point of this query. This number will increment based on the rows parameter passed in.
  • docs - The docs array, which holds the query results.

An example result message would be:

{
    "responseHeader": {
        "status": 0,
        "QTime": 1
    }
    "response": {
        "numFound": 21,
        "start": 0,
        "docs": [
            {
                "id": "GB18030TEST",
                "name": "Test with some GB18030 encoded characters",
                "features": [
                    "No accents here",
                    "这是一个功能",
                    "This is a feature (translated)",
                    "这份文件是很有光泽",
                    "This document is very shiny (translated)"
                ],
                "price": 0,
                "price_c": "0,USD",
                "inStock": true,
                "_version_": 1475520188742893600
            },
            {
                "id": "SP2514N",
                "name": "Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133",
                "manu": "Samsung Electronics Co. Ltd.",
                "manu_id_s": "samsung",
                "cat": [
                    "electronics",
                    "hard drive"
                ],
                "features": [
                    "7200RPM, 8MB cache, IDE Ultra ATA-133",
                    "NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor"
                ],
                "price": 92,
                "price_c": "92,USD",
                "popularity": 6,
                "inStock": true,
                "manufacturedate_dt": 1139844397000,
                "store": "35.0752,-97.032",
                "_version_": 1475520188790079500
            },
            {
                "id": "6H500F0",
                "name": "Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300",
                "manu": "Maxtor Corp.",
                "manu_id_s": "maxtor",
                "cat": [
                    "electronics",
                    "hard drive"
                ],
                "features": [
                    "SATA 3.0Gb/s, NCQ",
                    "8.5ms seek",
                    "16MB cache"
                ],
                "price": 350,
                "price_c": "350,USD",
                "popularity": 6,
                "inStock": true,
                "store": "45.17614,-93.87341",
                "manufacturedate_dt": 1139844397000,
                "_version_": 1475520188795322400
            },
            {
                "id": "F8V7067-APL-KIT",
                "name": "Belkin Mobile Power Cord for iPod w/ Dock",
                "manu": "Belkin",
                "manu_id_s": "belkin",
                "cat": [
                    "electronics",
                    "connector"
                ],
                "features": [
                    "car power adapter, white"
                ],
                "weight": 4,
                "price": 19.95,
                "price_c": "19.95,USD",
                "popularity": 1,
                "inStock": false,
                "store": "45.18014,-93.87741",
                "manufacturedate_dt": 1122913825000,
                "_version_": 1475520188807905300
            },
            {
                "id": "IW-02",
                "name": "iPod & iPod Mini USB 2.0 Cable",
                "manu": "Belkin",
                "manu_id_s": "belkin",
                "cat": [
                    "electronics",
                    "connector"
                ],
                "features": [
                    "car power adapter for iPod, white"
                ],
                "weight": 2,
                "price": 11.5,
                "price_c": "11.50,USD",
                "popularity": 1,
                "inStock": false,
                "store": "37.7752,-122.4232",
                "manufacturedate_dt": 1139961359000,
                "_version_": 1475520188810002400
            }
        ],
    }
}

Docker

Set up a running docker solr container with the following:

docker run --name my_solr -d -p 8983:8983 -t solr:6.2.1-alpine
docker exec -it --user=solr my_solr bin/solr create_core -c gettingstarted
docker exec -it --user=solr my_solr bin/post -c gettingstarted example/exampledocs/manufacturers.xml
com.englishtown.vertx

Labs @ EF Education First

Repositories moving to https://github.com/ef-labs

Versions

Version
2.1.0
2.0.0
2.0.0-RC5
2.0.0-RC4
2.0.0-RC3
2.0.0-RC2
2.0.0-RC1