Comprehensive Guide to Search Algorithms in Computer Science

Depth-First Search (DFS) DFS explores as far as possible along each branch before backtracking. It's implemented using recursion or a stack. def dfs(graph, node, visited): if node not in visited: visited.add(node) for neighbor in graph[node]: dfs(graph, neighbor, visited) Applications Maze Solving: DFS can find ...

Posted on Fri, 26 Jun 2026 17:06:15 +0000 by ericw

Elasticsearch Search Result Customization: Sorting, Pagination, Highlighting, and Java Client Usage

Sorting Search Results By default, Elasticsearch orders results by relevance score (_score). Custom sorting is supported for fields of type keyword, numeric types, geo_point, and date. Sorting direction is specified using asc or desc. GET /products/_search { "query": { "match_all": {} }, "sort": [ { "c ...

Posted on Wed, 20 May 2026 04:29:30 +0000 by Evanthes

Elasticsearch Practical Techniques: Indexing, Querying, and Operations

A compilation of Elasticsearch usage tips distilled from a knowledge base, covering index management, mapping, query operations, filtering, aggregation, and search templates. Index Management Elasticsearch structures queries in JSON-like format, using keywords to invoke operations. Creating an Index This example creates a index with 5 primary s ...

Posted on Sat, 16 May 2026 20:45:14 +0000 by zebrax

Core Query Types in Elasticsearch DSL

Elasticsearch queries are categorized into simple, compound, and aggregation types. This secsion details the core simple query operations. term Query: A single-term query. It searches for the exact condition value in the field's inverted index (if the field is analyzed) or directly in the field value (if not analyzed). A match yields a score of ...

Posted on Sun, 10 May 2026 08:57:29 +0000 by XiaoRulez

Foundations of Search: Classic Problems and Algorithmic Insights

A: Chessboard Rook Placement Given an (n \times n) board where certain positions marked # allow placement, determine the number of ways to place (k) identical, non-attacking rooks. Constraints: (k \leq n \leq 8). Since each row can hold at most one rook, a depth-first search over rows is feasible. The state space is bounded by ((n+1)^n), at mos ...

Posted on Thu, 07 May 2026 01:45:42 +0000 by benzrf