Skip to content

Instantly share code, notes, and snippets.

View priyankajayaswal1's full-sized avatar
👋
yo fellas !!

Priyanka Jayaswal priyankajayaswal1

👋
yo fellas !!
View GitHub Profile
@priyankajayaswal1
priyankajayaswal1 / swagger.json
Last active June 14, 2020 11:32
Swagger.json
{
"basePath": "/",
"consumes": [
"application/json"
],
"definitions": {
"Todo": {
"properties": {
"id": {
"description": "The task unique identifier",
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1 5 6 3 0 2 4
3 2 5 4 1 0 6
3 0 6 4 1 2 5
2 6 4 3 0 1 5
1 3 4 2 0 5 6
4 0 1 2 3 5 6
5 1 0 4 3 6 2
6 1 3 5 4 2 0
1 6 2 5 0 3 4
0 1 6 4 3 5 2

Solr-5.2-1-searching-and-indexing

Steps:

  • Start Solr: bin/solr start

  • Create a "geospace" core: bin/solr create -c geospace

  • Copy the content of the link below on the terminal [the given data is data specific here fro geospace.csv]

WORKING WITH PARSER CODE.

  • Install solr first. (Used version 5.2.1) (Just download it from the website and extract it . You are then ready to go with it.)
  • Follow the instructions in the given link below to create a new core using automated managed schema factory (you need to provide your own data file here it's geospace.csv) ---- https://gist.github.com/priyankajayaswal1/ae709395a0ef9fd484c1
  • Once done the date must be indexed. Now you may change to classic manual schema editing mode by making necessary changes in the managed-schema and solrconfig.xml file created. An example schema file and solrconfig file which worked for our data is provided int the links. ---- https://gist.github.com/priyankajayaswal1/ae709395a0ef9fd484c1

The other instruction to use file will follow as under:

curl "http://localhost:8983/solr/tutorial/update? stream.file=electdata.csv&commit=true&stream.contentType=text/csv;charset=utf-8"
# Helper function to calulate index price for the representative curve.
# gorl =1 implies all the Rep_KVA values above the given kva value shall be summed up and sent.
# gorl = -1 implies all the Rep_KVA below the passed kva value shall be deducted with the kva and their summation shall be sent.
AreaIntegrator <- function(A,kva,gorl=1)
{
if(gorl==1)
{
B = fn$sqldf("select * from A where Rep_KVA>$kva")
}
else if(gorl==-1)
AreaIntegrator = function(A,kva,gorl=1)
{
if(gorl==1)
{
B = fn$sqldf("select * from A where Rep_KVA>$kva")
}
else if(gorl==-1)
{
B = fn$sqldf("select * from A where Rep_KVA<$kva")
}
library(sqldf)
x<-read.table("//home//innovator//Documents//Internship//Data//household_power_consumption.txt",header=TRUE,sep=';',dec = '.',stringsAsFactors=FALSE)
x$Date<- as.Date(x$Date,"%d/%m/%Y")
x$Time = format(as.POSIXlt(x$Time, format = "%H:%M:%S"), format="%H:%M:%S")
x$Global_active_power = as.numeric(x$Global_active_power)
x$Global_reactive_power = as.numeric(x$Global_reactive_power)
x$KVA = sqrt(x$Global_active_power*x$Global_active_power+x$Global_reactive_power*x$Global_reactive_power)
x$Day = weekdays(x$Date)
# Creating sample pools for six month data
library(sqldf)
x<-read.table("//home//innovator//Documents//Internship//Data//household_power_consumption.txt",header=TRUE,sep=';',dec = '.',stringsAsFactors=FALSE)
x$Date<- as.Date(x$Date,"%d/%m/%Y")
x$Time = format(as.POSIXlt(x$Time, format = "%H:%M:%S"), format="%H:%M:%S")
x$Global_active_power = as.numeric(x$Global_active_power)
x$Global_reactive_power = as.numeric(x$Global_reactive_power)
x$KVA = sqrt(x$Global_active_power*x$Global_active_power+x$Global_reactive_power*x$Global_reactive_power)
# Creating sample pools for six month data
first<- as.Date('16-12-2008',format = '%d-%m-%Y')