<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ankit Raj</title>
    <description>The latest articles on DEV Community by Ankit Raj (@anktrj).</description>
    <link>https://dev.to/anktrj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F247894%2Ffa283def-877f-4a07-99de-afcc50df268b.jpeg</url>
      <title>DEV Community: Ankit Raj</title>
      <link>https://dev.to/anktrj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anktrj"/>
    <language>en</language>
    <item>
      <title>The Search Engine's Secret Sauce: Understanding Inverted Indexes</title>
      <dc:creator>Ankit Raj</dc:creator>
      <pubDate>Sat, 31 Jan 2026 18:30:14 +0000</pubDate>
      <link>https://dev.to/anktrj/lkjgsdoijsgdk-5637</link>
      <guid>https://dev.to/anktrj/lkjgsdoijsgdk-5637</guid>
      <description>&lt;h1&gt;
  
  
  The Search Engine's Secret Sauce: A Deep Dive into Inverted Indexes
&lt;/h1&gt;

&lt;p&gt;When you type a query into a search engine or a database like Elasticsearch, you don't want to wait for the system to scan every single document to find your keywords. That would be like reading every book in a library cover-to-cover just to find a mention of "distributed systems."&lt;/p&gt;

&lt;p&gt;To solve this, we use the &lt;strong&gt;Inverted Index&lt;/strong&gt;. It is the foundational technology behind Apache Lucene, Elasticsearch, and the core of modern information retrieval.&lt;/p&gt;




&lt;h2&gt;
  
  
  What exactly is an Inverted Index?
&lt;/h2&gt;

&lt;p&gt;In a standard &lt;strong&gt;Forward Index&lt;/strong&gt;, you have a list of documents, and each document contains a list of words.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;Inverted Index&lt;/strong&gt; flips this logic. It stores a list of every unique word (a "term") and, for each word, a list of the documents where it appears.&lt;/p&gt;

&lt;p&gt;Think of it like the &lt;strong&gt;index at the back of a technical textbook&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Terms:&lt;/strong&gt; The keywords listed alphabetically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Postings:&lt;/strong&gt; The page numbers (Document IDs) where those keywords appear.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How It’s Built: The Pipeline
&lt;/h2&gt;

&lt;p&gt;Before a word enters the index, it goes through a "Text Analysis" pipeline. This ensures that the search is flexible and efficient.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Tokenization:&lt;/strong&gt; Breaking strings into individual terms (e.g., &lt;code&gt;"The cat sat"&lt;/code&gt; becomes &lt;code&gt;["The", "cat", "sat"]&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Normalization:&lt;/strong&gt; Converting tokens to lowercase so "Search" and "search" match.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Stop Word Removal:&lt;/strong&gt; Deleting high-frequency, low-value words like "the," "is," and "a."&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Stemming/Lemmatization:&lt;/strong&gt; Reducing words to their root form. For example, "running," "runs," and "ran" are all indexed as the term "run."&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The "Flipped" Logic in Action
&lt;/h3&gt;

&lt;p&gt;Imagine we have two simple documents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Doc 1:&lt;/strong&gt; "Code, test, deploy."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Doc 2:&lt;/strong&gt; "Code and refactor."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After processing, the index looks like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Term&lt;/th&gt;
&lt;th&gt;Document IDs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;code&lt;/td&gt;
&lt;td&gt;1, 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;deploy&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;refactor&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;test&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Why Developers Use It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Lightning Fast Lookups
&lt;/h3&gt;

&lt;p&gt;Searching for a term becomes a simple key lookup. Instead of an $O(n)$ full-text scan, you get efficiency closer to $O(1)$ or $O(\log n)$ depending on the dictionary implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Complex Boolean Logic
&lt;/h3&gt;

&lt;p&gt;Inverted indexes make intersection and union operations trivial.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AND Search:&lt;/strong&gt; Find the intersection of two document lists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OR Search:&lt;/strong&gt; Find the union of two document lists.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Relevance Scoring
&lt;/h3&gt;

&lt;p&gt;Because we know how many times a word appears across all documents, we can easily calculate metrics like &lt;strong&gt;TF-IDF&lt;/strong&gt; (Term Frequency-Inverse Document Frequency) or &lt;strong&gt;BM25&lt;/strong&gt; to rank results by relevance.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Trade-offs
&lt;/h2&gt;

&lt;p&gt;Engineering is always about trade-offs. The primary costs of an inverted index are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Storage Overhead:&lt;/strong&gt; The index can often be nearly as large as the original data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write Latency:&lt;/strong&gt; Every time you add or update a document, the index must be updated. This is why "Near Real-Time" (NRT) search is common—it takes a moment for the index to "refresh."&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The inverted index is a classic "space-for-speed" trade-off. By doing the heavy lifting during the indexing phase, we enable the instantaneous search experiences that users expect today.&lt;/p&gt;




&lt;h3&gt;
  
  
  Further Reading
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://lucene.apache.org/" rel="noopener noreferrer"&gt;How Lucene uses Finite State Transducers (FST)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html" rel="noopener noreferrer"&gt;Elasticsearch: The Definitive Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>WebDev for beginners: The Path</title>
      <dc:creator>Ankit Raj</dc:creator>
      <pubDate>Thu, 17 Sep 2020 07:47:48 +0000</pubDate>
      <link>https://dev.to/anktrj/webdev-for-beginners-the-path-1e0n</link>
      <guid>https://dev.to/anktrj/webdev-for-beginners-the-path-1e0n</guid>
      <description>&lt;p&gt;This starts when I was starting with WebDev. I was suggested to start with HTML, CSS, and JavaScript. I returned to my room and started with HTML. It was the easiest. Then I started CSS and to be frank it seemed easy, just a bunch of style elements like font, position, paddings, etc, easy-peasy right? Here my actual love-hate relation started with CSS 😒. Now came Js it was easy as I came from C++.&lt;/p&gt;

&lt;p&gt;After this done, most of the beginners including me 😌 think that we're now WAB DEVLAPEORS.&lt;/p&gt;

&lt;h1&gt;
  
  
  THE PATH
&lt;/h1&gt;

&lt;p&gt;Now that I somehow have managed to get some experience in WebDev. I wanted you to not go through the same pain. Here is a kind of right path for learning WebDev.&lt;/p&gt;

&lt;p&gt;First HTML, CSS and JavaScript&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML is the easiest of all, you can find awesome blogs anywhere on the internet for this.&lt;/li&gt;
&lt;li&gt;CSS (love-hate 😊) is a great tool if learned the right way. After learning the bare basics, immediately go for the layouts the grids, flex. These are the most important, I repeat go for the Layouts. And Done! 😍. Now CSS frameworks will be pieces of Cake.&lt;/li&gt;
&lt;li&gt;JavaScript, if you come from C/C++, Java it will be very easy for you. For those who don't have any priors experience with any programming language. Go learn!.
Continuing with Js:

&lt;ul&gt;
&lt;li&gt;Start with the usual variables, conditional statements, loops, etc.&lt;/li&gt;
&lt;li&gt;Then go for DOM-Manipulation, you'll be able to implement hell lot of cool stuff. Like, make the Legendary Snake Game or any animations. See mine here &lt;a href="https://ankiiitraj.github.io" rel="noopener noreferrer"&gt;animations&lt;/a&gt;. I loved &lt;a href="https://www.youtube.com/user/shiffman" rel="noopener noreferrer"&gt;The Coding Train&lt;/a&gt; youtube channel. You can learn in-depth JS here following fun animation.&lt;/li&gt;
&lt;li&gt;Lastly, you need to know about the &lt;em&gt;asynchronous&lt;/em&gt; nature of JavaScript. This is what makes JavaScript, &lt;em&gt;JavaScript&lt;/em&gt;. I learned this while making &lt;a href="https://ankiiitraj.github.io/sorting-wait" rel="noopener noreferrer"&gt;Sorting Visualizer&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Now you are ready and you can go ahead and create a Portfolio website of your own, as a cool project, to showcase your learning. BTW here's mine &lt;a href="https://ankiiitraj.github.io" rel="noopener noreferrer"&gt;https://ankiiitraj.github.io&lt;/a&gt; 😬.&lt;/p&gt;

&lt;p&gt;Now comes the interesting part of creating a full-fledge &lt;strong&gt;Web-Application&lt;/strong&gt; that will have servers and databases.&lt;/p&gt;

&lt;p&gt;I will suggest going for the basics of Design-Patterns. I &lt;strong&gt;can not emphasize&lt;/strong&gt; more on this. I have been going on circles for months figuring out why/what is this folder and files.&lt;/p&gt;

&lt;p&gt;I finally read about &lt;strong&gt;MVC&lt;/strong&gt; and things got clearer form there.&lt;/p&gt;

&lt;p&gt;And that's it, now you're well equiped to learn any frameworks and libraries you will need, more efficiently.&lt;/p&gt;

&lt;p&gt;Make cool applications and help making lives better.&lt;/p&gt;

&lt;h3&gt;
  
  
  Thank you for reading
&lt;/h3&gt;

&lt;h1&gt;
  
  
  Peace ☮️
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>mvc</category>
    </item>
    <item>
      <title>Chef'sCamp - My introduction to WebDev</title>
      <dc:creator>Ankit Raj</dc:creator>
      <pubDate>Fri, 08 May 2020 06:31:30 +0000</pubDate>
      <link>https://dev.to/anktrj/chef-scamp-my-introduction-to-webdev-46c7</link>
      <guid>https://dev.to/anktrj/chef-scamp-my-introduction-to-webdev-46c7</guid>
      <description>&lt;h5&gt;
  
  
  Hello everyone!
&lt;/h5&gt;

&lt;p&gt;Today I will be talking about my first experience in WebDev. So it started with me qualifying for the second round after the coding round. This round was Web Development round. We were supposed to deliver a SPA or Single page application using ReactJs and Slim-a Php framework within 10 days.&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges 😵
&lt;/h3&gt;

&lt;p&gt;I had gone through the React documentation previously and React was not that of challenge in this round. The challenge was Php and overall I had never worked on back-end before. I had few insights of how it works but it was not clear.&lt;/p&gt;

&lt;h3&gt;
  
  
  Contest started 🏃
&lt;/h3&gt;

&lt;p&gt;The first 3-4 days were real tough. I had no idea on how to get started. Also I was searching for React-Php boiler plate everywhere. But turns out this was not required at all. I was very confused on how to connect React to the Php.&lt;br&gt;
But turns out things were not that difficult but I was making them. Now after this hassle, I got the hang around how are things working.&lt;br&gt;
Like I don't really have to worry about how react will connect to php. I didn't need a boilerplate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Development started 🌊
&lt;/h3&gt;

&lt;p&gt;I started by writing APIs and auth logic in Slim. This was fairly easy.&lt;br&gt;
I forgot to mention about implementing oAuth2.0 which was a disaster because I lost a significant time figuring out how to implement it.&lt;br&gt;
I got a big relief after completing back-end part.&lt;br&gt;
But the party was not over yet, with 3 days remaining. I started writing components on React. This took quite a while. I made a mistake of not using Material UI and writing inline CSS for each component which took significant time in implementing DarkMode later. &lt;br&gt;
Implementing Markdown with MathJax was a bit complicated for which I took help from &lt;a href="https://medium.com/@MatDrinksTea/rendering-markdown-and-latex-in-react-dec355e74119" rel="noopener noreferrer"&gt;Rendering Markdown and LaTeX in React&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment 🌀
&lt;/h3&gt;

&lt;p&gt;I deployed it on Azure cloud. You can visit it here - &lt;a href="http://chefscamp.tech" rel="noopener noreferrer"&gt;ChefsCamp&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next
&lt;/h3&gt;

&lt;p&gt;I am very happy that I was able to complete the project on time. This was by far the best learning experience I ever had. I also qualified for the next round. 😁&lt;br&gt;
After that I have implemented hybrid caching for faster response time. I have perfected the DarkMode and planning for implementing a fairly new feature.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;I would really appreciate your thought on the application.&lt;/em&gt; 🙏
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Thank you for reading
&lt;/h4&gt;

&lt;h2&gt;
  
  
  Peace ☮️
&lt;/h2&gt;

</description>
      <category>webdev</category>
      <category>hackathon</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
