Skip to content

Instantly share code, notes, and snippets.

View martinferreira's full-sized avatar

Martin Ferreira martinferreira

View GitHub Profile
@martinferreira
martinferreira / gist:6be06888204e0941ab7e2c407dd49c46
Created May 31, 2019 23:30
Elastic search wildcard search vs fuzzy search
Introduction
When implementing fuzzy search, it's often confused with wild card search. So its important distinguish the two first of all. Fuzzy search implies that it searches for the spefied phrase(s) and anything related to it by a factor of fuzziness. So example in a data set of {"Martin", "Sipho", "Daniel" , "Pieter", "Peter"} , looking for Peter will also return Pieter as its "close enough". Wildcard search returns all result that includes the phase or subset. For example, if "ter" was searched for will return {"Pieter", "Peter"} whilst looking for "Peter" it will only return "Peter"
Fuzzy Search in Elastic Search
A simple example of a query will be:
1
"query": {
2
"bool": {
public function getRecentActivityInbox()
{
return $this->ig->request('news/inbox/')
->getResponse(new Response\ActivityNewsResponse());
}
* ActivityNewsResponse.
*
* @method mixed getAdsManager()
* @method Model\Aymf getAymf()
COOKIE_FILE = "linkedinheader.txt";
import browser_cookie3;
import requests;
cj = browser_cookie3.load(domain_name='www.linkedin.com');
r = requests.get("http://www.linkedin.com", cookies=cj)
f= open(COOKIE_FILE,"w+")
link="https://www.linkedin.com/voyager/api/messaging/conversations?keyVersion=LEGACY_INBOX&count=20"
<!DOCTYPE html>
<html>
<head>
<?php
##$curl = curl_init();
##$timeout = 30;
##$ret = "";
##$url="http://localhost:82/put_val?val=".$_GET["val"];
@martinferreira
martinferreira / sql
Last active May 17, 2017 08:08
17790 : AC: Prototype automation of one off jobs for trident deploys
BEGIN
DECLARE @InvocationData VARCHAR(500)
SET @InvocationData = '{"Type":"Lightstone.Trident.Api.Jobs.ElasticSearchRebuildIndexes, Lightstone.Trident.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","Method":"RebuildIndexes","ParameterTypes":"[]","Arguments":"[]"}'
INSERT into [HangFire].[Job] (StateId, StateName, InvocationData, Arguments, CreatedAt, ExpireAt) values (NULL, 'Enqueued', @InvocationData,'[]', GETUTCDATE(), NULL)
DECLARE @JobId int
select @JobId=id from [HangFire].[Job] where statename = 'Enqueued' and invocationdata = @InvocationData and StateId is null
INSERT into [HangFire].[State] ( JobId, Name, Reason, CreatedAt, Data) values
( @JobId, 'Enqueued', NULL, GETUTCDATE(), '{"EnqueuedAt":"' + (CONVERT(VARCHAR,GETUTCDATE(), 120))+'","Queue":"default"}')
DECLARE @StateId int
SELECT @StateId = id from [HangFire].[State] Where JobId = @JobId