Indexing csv data in Solr via Python – PySolr

Here is a crisp post to index Data in Solr using Python. 1. Install Pre-requisites – pip – PySolr 2. Python Script #!/usr/bin/python import sys, getopt import pysolr import csv, json #SOLR_URL=http://54.254.192.149:8983/solr/feeddata/ def main(args): solrurl=” inputfile=” try: opts, args = getopt.getopt(args,”hi:u:”) except getopt.GetoptError: print ‘index_data.py -i -u ‘ sys.exit(2) for opt, arg in opts: if …

More

PySolr : How to boost a field for Solr document

Adding a Quick note – PySolr : How to boost a field for Solr document Index time boosting conn.add(docs, boost={‘author’: ‘2.0’,}) Query time boosting qf=title^5 content^2 comments^0.5 Read: http://java.dzone.com/articles/options-tune-document%E2%80%99s     Yash SharmaYash Sharma is a Big Data & Machine Learning Engineer, A newbie OpenSource contributor, Plays guitar and enjoys teaching as part time hobby. Talk …

More

JSolr Exception – Exception in thread “main” org.apache.solr.common.SolrException: Bad Request

Exception in thread “main” org.apache.solr.common.SolrException: Bad Request Bad Request request: http://54.254.192.149:8983/solr/feeddata/update?wt=javabin&version=2 Solution: Check Solr logs. INFO – 2014-11-07 07:04:42.985; org.apache.solr.update.processor.LogUpdateProcessor; [feeddata] webapp=/solr path=/update params={wt=javabin&version=2} {} 0 1 ERROR – 2014-11-07 07:04:42.985; org.apache.solr.common.SolrException; org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: id Here it is: Document is missing mandatory uniqueKey field: id   Another instance: INFO – …

More

Indexing CSV data file in Solr – Using annotated java pojo’s

1. Java pojo: Add the Java POJO with the required fields- import org.apache.solr.client.solrj.beans.Field; /** * Created by yash on 18/11/14. */ public class ProductBean { @Field private int id; @Field(“rank”) private int rank; @Field(“prodid”) private long prodid; @Field(“cat”) private int cat; @Field(“subcat”) private int subcat; public ProductBean(){} // Required by Solr to initialize bean. public …

More

Installing Solr on ubuntu

Here is a quick dirty post on installing SOLR on your box. Hope its helpful. Download SOLR Get new Solr copy. I got my copy from https://lucene.apache.org/solr/downloads.html. Download a version you are interested in. Preferrably the latest version. – extract out solr – copy /examples contents to – /opt/solr – check for another solr dir inside …

More