Utopian Solrizer - get utopian posts indexed in Solr

in #utopian-io6 years ago (edited)

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

Sort:  

Thank you for the contribution. It has been approved.

What you are doing here is getting a permalink and the username and indexing one at a time, if you have like 100 posts that means you have to run it 100 time to index. What if I have to index all the documents of Utopian at Once?

You can contact us on Discord.
[utopian-moderator]

Thanks for your suggestion. I will definitely add it into next version.

why not elastic search?

good point, it's in my list.

Hey @yuxi I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.029
BTC 57839.82
ETH 3132.70
USDT 1.00
SBD 2.43