yuxi avatar

Utopian Solrizer - get utopian posts indexed in Solr

yuxi

Published: 09 Mar 2018 › Updated: 09 Mar 2018Utopian Solrizer - get utopian posts indexed in Solr

Utopian Solrizer - get utopian posts indexed in Solr

What is the project about?

This project is aiming to index Utopian posts into solr, making it possible to do advanced searches.

Apache Solr is an open source enterprise search platform. Its major features include full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features and rich document (e.g., Word, PDF) handling.

Technology Stack

Ruby V2.4

Gem V2.6.11

Apache Solr V5.0+

Utopian Ruby 0.0.3.1

Roadmap

The current implementation performs CRUD to Solr server. As the focus of Solr is searching texts, Utopian Solrizer currently only index text fields, e.g. author, title, body, moderator etc and ignoring other fields, e.g. votes, pending payout. However, it's very easy to modify the code to index whatever you want. There are some features to be addressed in the future iterations.

  • Index comments
  • Move solr fields definition into a config file to give users more flexibility
  • Add rake tasks to do batch job, e.g. add Utopian posts into Solr

Test

A set of rspec test has been written here:

https://github.com/yuxir/utopian-solrizer/blob/master/spec/utopian_solrizer_spec.rb

How to contribute?

Just fork this project, create your feature branch, commit your changes and send a pull request!

https://github.com/yuxir/utopian-solrizer

Installation

This gem has been registered in rubygems.org :

Assuming you already have Ruby development configured, then run:

gem install utopian_solrizer

How to use it?

Assuming you have installed and configured Solr correctly. If not, please check the offical Solr website for more information.

Add Utopian post to solr

solr_options = { read_timeout: 120, open_timeout: 120, url: 'http://localhost:8983/solr/utopian' }
post = UtopianRuby::UtopianRubyAPI.get_post_obj('yuxi','utopian-api-ruby-client')
UtopianSolrizer.solrize_post(post, solr_options)

Query Solr to find all Utopian posts

params = { :q => "*:*" }
response = UtopianSolrizer.query(solr_options, params)

Check if an Utopian post indexed in Solr

UtopianSolrizer.exist(solr_options, id)

Index Utopian posts within a certain period to Solr

UtopianSolrizer.solrize_posts_within_minutes({"limit":1,"status":"reviewed","type":"development"}, solr_options, 60*2)

Example of indexed Utopian posts in Solr

Proof of work

I have added my Steemit account link in the README:



Posted on Utopian.io - Rewarding Open Source Contributors

Leave Utopian Solrizer - get utopian posts indexed in Solr to:

Written by

Developer

Read more #utopian-io posts


Best Posts From yuxi

We have not curated any of yuxi's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From yuxi