Giter Club home page Giter Club logo

solring's Introduction

Solring

Solring is an easy-to-use import tool from solr to local storage. By supporting various options we can create custom queries and save from a running Solr server to a file.

How it works

$ pip install solring==0.0.2

$ solring --help  
usage: Solring.py [-h] [--version] --url URL [--output OUTPUT]
                  [--save_format {csv,txt}] --core CORE [--rows ROWS] [-fl FL]
                  [-q Q] [-fq FQ] [--score] [--qt QT]
                  {group} ...

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --url URL, -u URL     The host:port of the running solr.
  --output OUTPUT, -o OUTPUT
                        Output file name.
  --save_format {csv,txt}, -sf {csv,txt}
                        File type of saved records. Default is txt.
  --core CORE, -c CORE  The core/collection in solr.
  --rows ROWS, -r ROWS  The number of row numbers returned. By default, Solr
                        returns 5 batches at a time to save records.
  -fl FL                Field list to retrieve. By default, Solr returns the
                        id field.
  -q Q                  Search query. By default, Solr returns all records.
  -fq FQ                Filter queries.
  --score               Learn score of each record in a score field.
  --qt QT               solr request handle to query on, default is '/select'.

group command:
  {group}               group help

The group command parameters:

$ solring group --help
usage: Solring.py group [-h] --group_fl GROUP_FL --group_agg
                        {mean,min,max,count} --group_column GROUP_COLUMN

optional arguments:
  -h, --help            show this help message and exit
  --group_fl GROUP_FL   The field(s) we want to use to group by.
  --group_agg {mean,min,max,count}
                        Aggregation functions to use in group by. Default is
                        count.
  --group_column GROUP_COLUMN
                        The field(s) where we want to aggregate.

Create a custom query where the query we search for is 'boat', we have two filter queries, and we only need to know their ids and titles as follows:

solring --url http://127.0.0.1:8983\ 
 -c boats \
 -fq "cabin:[6 TO *]" \
 -fq harbors:marmaris \
 -q boat \
 -fl id,title,boat_size,group_id

$ ls 
output.txt

Let's now aggregate the above request with group options. We can learn the min and max of boats_size of each group:

solring --url http://127.0.0.1:8983\ 
 -c boats \
 -fq "cabin:[6 TO *]" \
 -fq harbors:marmaris \
 -q boat \
 -r 100 \
 -fl id,title,boat_size,group_id \
 -o groupby_boats \
 group --group_agg min --group_agg max --group_column boat_size --group_fl group_id

$ ls รฆ
groupby_boats.txt

LICENSE

MIT

solring's People

Contributors

ozlerhakan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.