Giter Club home page Giter Club logo

solrmongoimporter's Introduction

Solr Mongo Importer

Welcome to the Solr Mongo Importer project. This project provides MongoDb support for the Solr Data Import Handler.

Features

  • Retrive data from a MongoDb collection
  • Authenticate using MongoDb authentication
  • Map Mongo fields to Solr fields
  • Delta import available

Classes

  • MongoDataSource - Provides a MongoDb datasource
    • database (required) - The name of the data base you want to connect to
    • host (optional - default: localhost)
    • port (optional - default: 27017)
    • username (optional)
    • password (optional)
  • MongoEntityProcessor - Use with the MongoDataSource to query a MongoDb collection
    • collection (required)
    • query (required)
    • deltaQuery (optional)
    • deltaImportQuery (optional)
  • MongoMapperTransformer - Map MongoDb fields to your Solr schema
    • mongoField (required)

Installation

  1. Firstly you will need a copy of the Solr Mongo Importer jar.

    Getting Solr Mongo Importer

    1. Download the latest JAR from github
    2. Build your own using the ant build script you will need the JDK installed as well as Ant and Ivy
  2. You will also need the [Mongo Java driver JAR] (https://github.com/mongodb/mongo-java-driver/downloads)

  3. Place both of these jar's in your Solr libaries folder ( I put mine in 'dist' folder with the other jar's)

  4. Add lib directives to your solrconfig.xml

    <lib path="../../dist/solr-mongo-importer-{version}.jar" />
    <lib path="../../dist/mongo.jar" />

Usage

Here is a sample data-config.xml showing the use of all components

<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
     <dataSource name="MyMongo" type="MongoDataSource" database="Inventory" />
     <document name="Products">
         <entity processor="MongoEntityProcessor"
                 query="{'Active':1}"
                 collection="ProductData"
                 datasource="MyMongo"
                 deltaQuery="{'UpdateDate':{$gt:{$date:'${dih.last_index_time}'}}}"
                 deltaImportQuery="{'_id':'${dih.delta._id}'}"
                 transformer="MongoMapperTransformer" >
             <field column="title"           name="title"       mongoField="Title"/>
             <field column="description"     name="description" mongoField="Long Description"/>
             <field column="brand"           name="brand"  />
         </entity>
     </document>
 </dataConfig>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.