Skip to content

Instantly share code, notes, and snippets.

Types of Analyzers

Analyzer Description Example Use
Standard Default; breaks text by word boundaries, removes most punctuation, lowercases tokens. English prose, general search
Simple Splits on non-letter, lowercases. Part numbers, technical terms
Whitespace Splits on whitespace only, preserves case. Code, serial numbers
Keyword Does not split; treats entire text as a single token. Exact match fields, IDs, tags
Feature TF-IDF BM25
Full Form Term Frequency – Inverse Document Frequency Best Matching 25
Default in Elasticsearch ❌ (before v5.0) βœ… (v5.0 and later)
Term Frequency Handling Linear Saturated (diminishing returns)
Document Length Normalization Minimal Tunable and robust
Tunable Parameters No Yes (k1, b)
Use Case TF-IDF BM25
Simple scoring model βœ… βœ…
Accurate relevance for modern search ❌ βœ…
Normalize for document length ❌ βœ…
Tune scoring behavior with parameters ❌ βœ…

πŸ“˜ SQLAlchemy Relationship Types

This guide demonstrates the four common types of relationships in SQLAlchemy using realistic examples:

  • βœ… One-to-One: User β†’ UserProfile

  • βœ… One-to-Many: Blog β†’ BlogPost

πŸ“˜ PostgreSQL Query Plan Examples

This document demonstrates various PostgreSQL query plan types, with sample datasets, queries, and EXPLAIN/EXPLAIN ANALYZE outputs.


βœ… Step 1: Basic Table and Data

@sany2k8
sany2k8 / python_framework.md
Last active June 7, 2025 17:12
Python framework decision

Quick Decision Tree

  • REST API? β†’ FastAPI
  • Full web app? β†’ Django
  • Learning/Prototyping? β†’ Flask
  • Max performance? β†’ Falcon
  • Real-time? β†’ Sanic/FastAPI

Framework Comparison

Django

@sany2k8
sany2k8 / postgres-jsonb.md
Created July 25, 2024 12:25 — forked from kcranston/postgres-jsonb.md
intro to document stores in postgreSQL

Document stores in PostgreSQL

Notes for software engineering meeting presentation

What

  • mid to late 2000s: appearance of Document stores / NoSQL databases such as Mongo, Couch
  • Relational DBs now have support for document data: JSON in MySQL, JSON and JSONB in PostgreSQL
  • Focus on JSONB in Postgres (most full featured)
@sany2k8
sany2k8 / commit-message-format.md
Created December 26, 2023 09:46 — forked from develar/commit-message-format.md
Commit Message Format

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
@sany2k8
sany2k8 / pydantic_phone_number_field.py
Created September 16, 2022 14:54 — forked from iRhonin/pydantic_phone_number_field.py
Pydantic Phone Number Field
import phonenumbers
from pydantic.validators import strict_str_validator
class PhoneNumber(str):
"""Phone Number Pydantic type, using google's phonenumbers"""
@classmethod
def __get_validators__(cls):
yield strict_str_validator
yield cls.validate