<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Setareh Karimi on Medium]]></title>
        <description><![CDATA[Stories by Setareh Karimi on Medium]]></description>
        <link>https://medium.com/@setarekarimi.kh?source=rss-af05cceba39d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*I9ffdtYuIE3x9Vxa7UQ6Yw.jpeg</url>
            <title>Stories by Setareh Karimi on Medium</title>
            <link>https://medium.com/@setarekarimi.kh?source=rss-af05cceba39d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 22:07:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@setarekarimi.kh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Notes from Reading Introduction to Information Retrieval — Chapter 1: Boolean Retrieval]]></title>
            <link>https://medium.com/@setarekarimi.kh/notes-from-reading-introduction-to-information-retrieval-chapter-1-boolean-retrieval-bbeaaed67861?source=rss-af05cceba39d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbeaaed67861</guid>
            <category><![CDATA[search-engines]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[information-retrieval]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <dc:creator><![CDATA[Setareh Karimi]]></dc:creator>
            <pubDate>Sat, 06 Jun 2026 19:06:17 GMT</pubDate>
            <atom:updated>2026-06-06T19:06:17.478Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I started reading <em>Introduction to Information Retrieval</em> by Christopher Manning, Prabhakar Raghavan, and Hinrich Schütze.</p><p>Although I’ve worked with search systems and Elasticsearch, I wanted to strengthen my understanding of the Information Retrieval concepts that power modern search engines. This book is widely considered one of the foundational resources in the field, so I decided to work through it and document some of the ideas that I find particularly interesting from an engineering perspective.</p><p>These notes are not intended to be a comprehensive summary of the chapter. Instead, they are a collection of concepts, examples, and insights that stood out to me while reading.</p><h3>What is Information Retrieval?</h3><p>Information Retrieval (IR) is the process of finding relevant documents from a large collection based on a user’s information need.</p><p>One distinction that immediately stood out to me is the difference between an <strong>information need</strong> and a <strong>query</strong>.</p><ul><li><strong>Information Need</strong>: What the user actually wants to know.</li><li><strong>Query</strong>: What the user types into the search box.</li></ul><p>For example, imagine someone trying to learn how to make better espresso at home.</p><p>Their information need might be:</p><blockquote><em>“I want recommendations for brewing better espresso at home.”</em></blockquote><p>But the queries they submit could be:</p><pre>espresso brewing tips</pre><p>or</p><pre>how to make better espresso</pre><p>or</p><pre>home espresso guide</pre><p>Even though the queries are different, they all express roughly the same information need.</p><p>This distinction is important because users rarely know the exact words that appear in the documents they’re looking for.</p><h3>Why Can’t We Scan Every Document?</h3><p>Suppose we have one million documents.</p><p>A straightforward implementation might look something like this:</p><pre>for _, doc := range documents {<br>    if contains(doc, &quot;coffee&quot;) &amp;&amp;<br>       contains(doc, &quot;espresso&quot;) {<br>        results = append(results, doc)<br>    }<br>}</pre><p>While this works, it requires scanning every document for every query.</p><p>As the collection grows, this quickly becomes impractical.</p><p>Instead of searching documents directly, search engines build an index ahead of time, allowing them to jump directly to potentially relevant documents.</p><h3>The Inverted Index</h3><p>The most important concept introduced in Chapter 1 is the <strong>inverted index</strong>.</p><p>Instead of storing:</p><pre>Document -&gt; Terms</pre><p>we store:</p><pre>Term -&gt; Documents</pre><p>Consider the following documents:</p><pre>Doc1: Best coffee beans for espresso<br>Doc2: Coffee brewing techniques<br>Doc3: Espresso recipes for beginners</pre><p>The inverted index becomes:</p><pre>coffee    -&gt; [1, 2]<br>beans     -&gt; [1]<br>espresso  -&gt; [1, 3]<br>brewing   -&gt; [2]<br>recipes   -&gt; [3]<br>beginners -&gt; [3]</pre><p>Now, if a user searches for “espresso”, we can immediately retrieve the documents associated with that term instead of scanning the entire collection.</p><h3>Dictionary and Postings Lists</h3><p>An inverted index consists of two main components.</p><h3>Dictionary</h3><p>The dictionary contains all unique terms in the collection.</p><pre>beans<br>brewing<br>coffee<br>espresso<br>recipes<br>beginners</pre><h3>Postings Lists</h3><p>For each term, we maintain a sorted list of document IDs where that term appears.</p><pre>coffee   -&gt; [1, 2]<br>espresso -&gt; [1, 3]</pre><p>Each document ID in the list is called a <strong>posting</strong>.</p><p>The entire list is called a <strong>postings list</strong>.</p><p>One thing I found interesting is that the dictionary often stores additional statistics, such as the number of documents containing each term (document frequency), which later becomes useful for ranking and query optimization.</p><h3>Boolean Retrieval</h3><p>Chapter 1 focuses on the Boolean Retrieval model.</p><p>Queries are expressed using Boolean operators:</p><ul><li>AND</li><li>OR</li><li>NOT</li></ul><p>For example:</p><pre>coffee AND espresso</pre><p>Using the postings lists:</p><pre>coffee   -&gt; [1, 2]<br>espresso -&gt; [1, 3]</pre><p>we perform an intersection operation:</p><pre>[1]</pre><p>which means that only Document 1 contains both terms.</p><p>Although this model is relatively simple, it introduces many of the core concepts used by modern search engines.</p><h3>Why Are Postings Lists Sorted?</h3><p>At first glance, sorting postings lists might seem like a minor implementation detail.</p><p>It turns out to be essential for efficient query processing.</p><p>Consider:</p><pre>coffee   -&gt; [1, 5, 10, 20]<br>espresso -&gt; [5, 20, 50]</pre><p>To evaluate:</p><pre>coffee AND espresso</pre><p>we can use two pointers and walk through both lists simultaneously:</p><pre>1 vs 5   -&gt; move left pointer<br>5 vs 5   -&gt; match<br>10 vs 20 -&gt; move left pointer<br>20 vs 20 -&gt; match</pre><p>Result:</p><pre>[5, 20]</pre><p>This algorithm runs in:</p><pre>O(x + y)</pre><p>where x and y are the lengths of the postings lists.</p><p>The key idea is that we never need to restart a search or scan documents again — we simply move forward through two sorted lists.</p><h3>Query Optimization</h3><p>Another interesting concept introduced in the chapter is query optimization.</p><p>Suppose we have the following document frequencies:</p><pre>espresso -&gt; 50 documents<br>coffee   -&gt; 10,000 documents<br>the      -&gt; 900,000 documents</pre><p>Now consider the query:</p><pre>espresso AND coffee AND the</pre><p>The most efficient strategy is:</p><pre>(espresso AND coffee) AND the</pre><p>rather than starting with the very common term:</p><pre>the AND coffee AND espresso</pre><p>The reason is simple: intersecting smaller postings lists first keeps intermediate results small and reduces the total amount of work.</p><p>This is one reason search engines keep document frequency statistics in memory — they help determine a more efficient execution plan before processing the query.</p><h3>My Takeaway</h3><p>Before reading this chapter, I mostly thought about search from the perspective of APIs, queries, and relevance tuning.</p><p>What stood out to me is how much of search performance depends on relatively simple data structures and algorithms.</p><p>The inverted index is conceptually straightforward, yet it enables search systems to scale from thousands to millions of documents efficiently.</p><p>It’s also interesting to see how many ideas used in systems like Elasticsearch and Lucene can be traced back to a few fundamental concepts: dictionaries, postings lists, sorting, and efficient set operations.</p><p>As I continue reading the book, I’ll keep sharing notes about the concepts that I find particularly useful from an engineering perspective.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbeaaed67861" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OOP Essentials: Exploring Abstract, Concrete, and Mixin Classes]]></title>
            <link>https://medium.com/@setarekarimi.kh/oop-essentials-exploring-abstract-concrete-and-mixin-classes-97aa2249a694?source=rss-af05cceba39d------2</link>
            <guid isPermaLink="false">https://medium.com/p/97aa2249a694</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[oop-concepts]]></category>
            <dc:creator><![CDATA[Setareh Karimi]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 15:54:12 GMT</pubDate>
            <atom:updated>2024-11-17T15:54:12.763Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. What is an Abstract Class?</h3><p>An <strong>abstract class</strong> serves as a blueprint for other classes. It defines a set of methods that must be implemented in its subclasses.</p><h4>Key Features:</h4><ul><li>Cannot be instantiated directly.</li><li>Can include both abstract methods (methods with no implementation) and concrete methods (methods with implementation).</li></ul><h4>Example:</h4><pre>from abc import ABC, abstractmethod<br><br># Define an abstract class<br>class Animal(ABC):<br>    @abstractmethod<br>    def sound(self):<br>        &quot;&quot;&quot;Abstract method to be implemented by subclasses&quot;&quot;&quot;<br>        pass<br><br>    def sleep(self):<br>        print(&quot;Animal is sleeping&quot;)<br><br><br>class Dog(Animal):<br>    def sound(self):<br>        print(&quot;Woof! Woof!&quot;)<br><br>class Cat(Animal):<br>    def sound(self):<br>        print(&quot;Meow!&quot;)<br><br>dog = Dog()<br>dog.sound()<br>dog.sleep()<br><br>cat = Cat()<br>cat.sound()</pre><h4>When to Use:</h4><ul><li>Use abstract classes when you want to define a common interface or behavior for multiple subclasses but leave the implementation to the subclasses.</li></ul><h3>2. What is a Concrete Class?</h3><p>A <strong>concrete class</strong> is a class that provides complete implementations for all its methods. Unlike abstract classes, concrete classes can be instantiated directly.</p><h4>Example:</h4><pre>class Dog:<br>    def sound(self):<br>        print(&quot;Woof! Woof!&quot;)<br>    <br>    def sleep(self):<br>        print(&quot;Dog is sleeping&quot;)<br><br><br>dog = Dog()<br>dog.sound()<br>dog.sleep()</pre><h4>When to Use:</h4><ul><li>Use concrete classes to define fully implemented objects that can be instantiated and used directly.</li></ul><h3>3. What is a Mixin Class?</h3><p>A <strong>mixin class</strong> is a type of class designed to add reusable functionality to other classes. It’s not meant to be instantiated on its own but instead is used to “mix in” additional behavior into other classes.</p><h4>Key Features:</h4><ul><li>Provides utility or additional functionality.</li><li>Works with multiple inheritance.</li><li>Usually stateless (doesn’t maintain instance variables).</li></ul><h4>Example:</h4><pre>class LoggerMixin:<br>    def log(self, message):<br>        print(f&quot;[LOG]: {message}&quot;)<br><br>class Animal:<br>    def __init__(self, name):<br>        self.name = name<br><br>class Dog(Animal, LoggerMixin):<br>    def sound(self):<br>        self.log(f&quot;{self.name} says: Woof!&quot;)<br><br>class Cat(Animal, LoggerMixin):<br>    def sound(self):<br>        self.log(f&quot;{self.name} says: Meow!&quot;)<br><br>dog = Dog(&quot;Scouter&quot;)<br>dog.sound()<br><br>cat = Cat(&quot;Cookie&quot;)<br>cat.sound()</pre><h4>When to Use:</h4><ul><li>Use mixin classes to add reusable methods to unrelated classes, like logging, authentication, or validation.</li></ul><h3>Conclusion</h3><p>Understanding abstract, concrete, and mixin classes helps you write cleaner, more modular code. Abstract classes enforce a contract for subclasses, concrete classes implement complete functionality, and mixin classes add reusable behavior. By combining these concepts effectively, you can design robust and maintainable applications.</p><p>Do you use these class types in your projects? Share your thoughts in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97aa2249a694" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git log command: Travel through time part 2]]></title>
            <link>https://medium.com/@setarekarimi.kh/git-log-command-travel-through-time-part-2-945daf04a17d?source=rss-af05cceba39d------2</link>
            <guid isPermaLink="false">https://medium.com/p/945daf04a17d</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[develop]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Setareh Karimi]]></dc:creator>
            <pubDate>Sat, 11 Dec 2021 21:49:50 GMT</pubDate>
            <atom:updated>2021-12-11T21:49:50.328Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*7faflBgTsiUIlv3xMIfTLg.jpeg" /></figure><p>In this medium I want describe more about how git log options can simplify your discovering through history. you can see a brief description in my last <a href="https://medium.com/@setarekarimi.kh/git-log-command-travel-through-time-6e674ad8c9a5">post</a>.</p><p>As you know ‘<strong>git log</strong>’ displays commit message, commit hash and some metadata like author and date.</p><p>In some cases it doesn’t matter who commits or maybe you don’t know the exact time that change was applied to the project. by reviewing commit’s subject you can find the considered commit. ‘<strong>oneline’</strong> option helps you.</p><pre>git log --oneline</pre><p>Here is an example of how this option works. you can see <a href="https://github.com/spf13/viper">Viper</a> repository:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*FoKHlMefxELYFEQQNfnx6A.png" /></figure><p>This is how you can see commit messages without any extra information.</p><p><strong>oneline</strong> is a simple and handful option, but how about little customization?</p><p>Imagine you need show commit information in every format you want. for a git lover that’s the dream!</p><p><strong>pretty</strong> is a powerful option that you use with proper placeholder to get your ideal result.</p><pre>git log --pretty=format:&quot;%ai | %an |  commited %h | %s&quot;</pre><p><strong>%ai:</strong> author date , ISO 8601-like format<br><strong>%an:</strong> author name<br><strong>%h:</strong> abbreviated commit hash<br><strong>%s:</strong> subject</p><p>result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*F2ZZ8QVQZHbTMxHv6EUviA.png" /><figcaption>customized git log</figcaption></figure><p>There are more placeholders for customizing log.<br>you can display details like commit description, notes, author email, commiter email and etc. Find out more in this <a href="https://git-scm.com/docs/pretty-formats">link</a>.</p><p>‌‌Besides all these formatting, it is possible to categorize commit messages (subject) based on authors:</p><pre>git shortlog</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*001m-wVimXSLpYxQddmjNA.png" /></figure><p>I think this is really useful. when you join on new team this command helps you to getting to know better your teammates.</p><p>Have you ever used these options in git log command?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=945daf04a17d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git log command: Travel through time]]></title>
            <link>https://medium.com/@setarekarimi.kh/git-log-command-travel-through-time-6e674ad8c9a5?source=rss-af05cceba39d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e674ad8c9a5</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[develop]]></category>
            <dc:creator><![CDATA[Setareh Karimi]]></dc:creator>
            <pubDate>Thu, 02 Dec 2021 21:59:06 GMT</pubDate>
            <atom:updated>2021-12-04T06:47:06.760Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*7faflBgTsiUIlv3xMIfTLg.jpeg" /></figure><p>Imagine you need to find a specific commit that belongs to you or your colleague. The project is huge and many people contributed.<br>maybe you are thinking: this is so simple, everybody knows <strong>git log</strong> command. But what if there are too many commits. you have to search through all the history. It takes too long to find the one.</p><p>But you can customize this command and discover whatever you want quickly.</p><p>The first scenario is when you almost know <em>when</em> specific changes happened in the project. you can filter commits that happened before a date.</p><pre>git log --before=&#39;2020-10-05&#39;</pre><p>or in some cases you may need to see all commits except today:</p><pre>git  log  --before=&#39;today&#39;</pre><p>you can retrieve commits that happened after a specified date:</p><pre>git log --after=&#39;2020-10-05&#39;</pre><p>Also, just like ‘today’, you can use ‘yesterday’ keyword</p><pre>git log --after=&#39;yesterday&#39;</pre><p>with this command, you can see all commits that are done in the current day.</p><p>you can filter commits between two specified dates:</p><pre>git log --after=&#39;2020-01-05&#39; --before=&#39;2020-01-15&#39;</pre><p>This is just a simple start. It’s going to get better and learn more about how git log is necessary for a rainy day!</p><p>In the second scenario, we are looking for commits that belong to a colleague or even ourselves! <br>you can do this in two ways:</p><p>You know the contributor&#39;s email that is set in git config:</p><pre>git log --author=&#39;example@gmail.com&#39;</pre><p>Or with the name that is set in git config:</p><pre>git log --author=&#39;John Doe&#39;</pre><p>Isn’t that interesting?</p><p>Now it’s time to mix up everything I mentioned above.<br>We want to check commits on specified dates that one of the contributors did in past. is it possible?<br>The answer is YES.</p><pre>git log --author=&#39;Setareh Karimi&#39; --before=&#39;2019-05-12&#39; --after=&#39;2019-05-03&#39;</pre><p>This command saved a lot of my time on a busy day.</p><p>git log has so many features that I can talk about and how they can simplify your work. I’ll describe more in my future posts.</p><p>Have you ever used this feature?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e674ad8c9a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>