com.englishtown:vertx-mod-solr

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

License

License

GroupId

GroupId

com.englishtown
ArtifactId

ArtifactId

vertx-mod-solr
Last Version

Last Version

0.2.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-mod-solr
Project Organization

Project Organization

Englishtown

Download vertx-mod-solr

How to add to project

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

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.solr : solr-solrj jar 4.8.1
commons-logging : commons-logging jar 1.1.3
org.slf4j : slf4j-api jar 1.7.7

provided (3)

Group / Artifact Type Version
com.englishtown : vertx-mod-hk2 jar 1.7.0
io.vertx : vertx-core jar 2.1
io.vertx : vertx-platform jar 2.1

test (3)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.5
junit : junit jar 4.11
io.vertx : testtools jar 2.0.3-final

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

Labs @ EF Education First

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

Versions

Version
0.2.0
0.1.0