Giter Club home page Giter Club logo

catmandu-solr's Introduction

NAME

Catmandu::Solr - Catmandu modules for working with solr endpoints

SYNOPSIS

# From the command line

# Import data into Solr
$ catmandu import JSON to Solr  < data.json

# Export data from ElasticSearch
$ catmandu export Solr to JSON > data.json

# Export only one record
$ catmandu export Solr --id 1234

# Export using an Solr query
$ catmandu export Solr --query "name:Recruitment OR name:college"

# Export using a CQL query (needs a CQL mapping)
$ catmandu export Solr --q "name any college"

AUTHOR

Nicolas Steenlant, nicolas.steenlant at ugent.be

Patrick Hochstenbach, patrick.hochstenbach at ugent.be

Nicolas Franck, nicolas.franck at ugent.be

SYNOPSIS

For documentation on these fixes see:

Catmandu::Store::Solr

Catmandu::Importer::Solr

SEE ALSO

Catmandu::Store

Catmandu

LICENSE AND COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

catmandu-solr's People

Contributors

manwar avatar nichtich avatar nicolasfranck avatar nics avatar phochste avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

catmandu-solr's Issues

The `--id-field` option works differently for Catmandu::Importer::Solr as for Catmandu::Store::Solr

When doing:

$ catmandu convert Solr --url http://localhost:8984/solr --id_field myfield

I get records where the content of myfield is put into the _id field of the resulting records:

---
_id: archive.ugent.be:00003832-ADE7-11E0-92CA-80A237D8FA8C
accessRights:
- ugent
date: 2016-08-26T08:55:51.45Z

When doing:

$ catmandu export Solr --url http://localhost:8984/solr --id_field myfield

the _id has an undefined content:

---
_id: ~
accessRights:
- ugent
date: 2016-08-26T08:55:51.45Z

Command line support for "bagless" Solr indexes

Using the Perl API of Catmandu one can access data in a Solr installation that doesn't have the notion of 'bags':

  my $store = Catmandu->store('Solr');
  $store->bag->searcher(query => 'any solr query')->each(sub {
  });

This is probably a bug that the bag doesn't have any effect in this code. But it is also a very nice feature to be able to support "bagless" Solr installations.

However, with the command line tools the "bag" is enforced in the Solr query on line 33: https://github.com/LibreCat/Catmandu-Solr/blob/master/lib/Catmandu/Store/Solr/Bag.pm#L33

This gives no results in "bagless" installations

  $ catmandu export Solr to YAML

Can searcher keep the support for bagless queries. Can this support also be added to the generator?

Bulk indexing via Catmandu

The current importer doesn't seem to support the bulk DataImportHandler method to add data to a Solr index in bulk. Pushing data record by record is a slow, error-prone process since it seems to re-trigger the indexing process each time a new record is pushed and committed to the index. The DataImportHandler method circumvents this.

We've implemented this method of indexing in the Datahub::Factory application (which is heavily based on the Catmandu architecture)

Would it be viable to reuse this code in this module as a separate importer?

See: https://github.com/thedatahub/Datahub-Factory/blob/master/lib/Datahub/Factory/Indexer/Solr.pm

The above module expects two inputs:

  • The local location of the JSON file which contains data to be uploaded.
  • The URL defined by the DataImportHandler in the Solr configuration.

Implementation looks like this:

my filename = "/tm/bulk.json"
my $requestHandler = "http://localhost:8983/solr/blacklight-core/update/json"
my $indexer = Datahub::Factory->indexer('Solr')->new(
    'file_name' = $filename,
    'request_handler' => $requestHandler
);
$indexer->import();
$indexer->commit();

Both methods will return the response of the handler API as a perl hash.
Both methods throw a Catmandu::HTTP:Error at the moment if something goes wrong.

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.