Skip to main content

Posts

Showing posts from April, 2020

ESS - 3.Tools and Technologies involved in modern search architecture - Part II

This discussion is continuation of Tools and Technologies involved in modern search architecture . Please use the  link  to access the part-I for a quick recap as the topics mentioned there may be referred here. In Search implementation once you're done with the challenges of Crawling the content and building an Inverted Index to quickly access the matched documents two more challenges are up for you: Relevant results to the user - Relevance Score Deliver results to the user - SERP Relevance Score: Relevance scoring is used by search engines to identify the order in which the documents should appear. Here's a documented definition: Relevance scoring uses the Boolean model to find matching documents and a formula called the practical scoring function to calculate relevance. This formula borrows concepts from TF-IDF (term frequency/inverse document frequency) and the vector space model but adds more modern features like a coordination factor, field length no...

Go #4 - Only loop in Go is For

For: for is the only looping construct in Go. Here are few example of for loops: func main() { //for loop with single condition i := 1 for i <= 10 { fmt.Println(i) i ++ } //for loop with initialization/condition/after for i := 1 ; i <= 10 ; i ++ { fmt.Println(i) } // for loop with break/return -- for without condition will loop // repeatedly until you break or return k := 5 for { if k == 2 { return } fmt.Println(k) k -- } } Happy Coding 🤖

Go #3 - Data Types, Variables and Type Inference

DataTypes: 1. Numeric Types: int8, int16, int32, int64, int uint8, uint16, uint32, uint64, uint float32, float64 complex64, complex128 byte rune 2. bool 3. string Declaration & Initialization: var name string = "GoBot" var salary int = 1000 var zipcode int var trueVal = true Type Inference: If you pass an initial value, Go will automatically be able to infer the type of the variable using initial value as in examples below: var name = "GoBot" var salary = 1000 city := "San Francisco" var a, b int = 5 , 7 var x, y = "Hello" , 2 fmt.Println(name, salary, city, a, b, x, y) Notice the ' := ' syntax in line 4 which is shorthand for declaring and initializing variable which is similar to writing ' var city string = "San Francisco" ' *- shorthand notation requires initial values for all variables on the left-hand side of the assignment *- shorthand notation can o...

Go #2 - Classic 'Hello World' program in Go

Code: 1 2 3 4 5 6 7 package main import "fmt" func main() { fmt.Println( "Hello World!" ) } - Every go file must start with ' package name ' - ' main() ' function should always exist in main package - import "fmt" is used to import required packages - ' fmt.Println("Hello World!")' here we are calling the Println function in fmt package so to call a function in Go we use the syntax  package.function() Happy Coding 🤖

Go #1 - Running a go program

Go Install go install - When you run the above command, Go will compile the program and installs a binary in the bin location. For mac it is created at '/usr/local/go/bin/trygo' by default. Steps: - Move to your project folder using "cd projects/go/src/trygo" - Run 'go install' - You can execute the binary using '~ / projects / go / bin/trygo' Possible issues: - Ran into the following issue when i ran the above command go install trygo: open / usr / local / go / bin / trygo: permission denied - I fixed it by changing the 'GOBIN' path in bashrc export GOBIN=~ / projects / go / bin export PATH=$PATH:$GOBIN Go Build go build - 'go build' is similar to 'go install' the only difference is it creates the binary inside the location you ran 'go build' - To run the program you can just say 'trygo/trygo' (The first trygo is the location for the binary and trygo is the binary file g...