<?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 Murat Elifoğlu on Medium]]></title>
        <description><![CDATA[Stories by Murat Elifoğlu on Medium]]></description>
        <link>https://medium.com/@elifoglumurat?source=rss-b697710d6471------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*FAEK84U_DDTlFSgU.jpg</url>
            <title>Stories by Murat Elifoğlu on Medium</title>
            <link>https://medium.com/@elifoglumurat?source=rss-b697710d6471------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 23:53:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elifoglumurat/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[Trendyol Search: Behind the Box]]></title>
            <link>https://medium.com/trendyol-tech/trendyol-search-behind-the-box-7df2c59b4c9a?source=rss-b697710d6471------2</link>
            <guid isPermaLink="false">https://medium.com/p/7df2c59b4c9a</guid>
            <category><![CDATA[similarity]]></category>
            <category><![CDATA[relevance]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[search]]></category>
            <dc:creator><![CDATA[Murat Elifoğlu]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 11:09:21 GMT</pubDate>
            <atom:updated>2019-04-04T11:09:21.409Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Algorithms &amp; Strategies</strong></p><p>When you come to any of Trendyol applications as a user, you see a simple text box which may be considered as a gate allowing you access the products that you are interested in most. You type a keyword and then you view a page full of products as shown in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0f82c6l86Fi-EDbF" /><figcaption>Basic search flow</figcaption></figure><p>As Search &amp; Smartlisting Team, we are the team whose main goal is to make happy our users listing the most relevant products for them. If the user clicks on a product listed on the first page, it is a plus for us. When the very first product is clicked, we are the king! Our goal is not to tire our users, because we love them:)</p><p>The request comes through an API, named Search API, when the user applies a search operation. After the request is processed, we produce a response including a list of products and a list of possible filters that can be applied on the search result. The Search API sends the coming request in a cycled pipeline in order to give the most meaningful result set to the client applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/0*KAfwWzyrx1wUBsZM" /><figcaption>Search pipeline</figcaption></figure><p>When we look at the pipeline, we see that the request first resolved into semantic parts by the query resolver. Then lots of search strategies process the resolved query sequentially. The search and aggregation operation is applied after the best search strategy for that request is decided. Finally, we apply a buybox operation in order to set the winner listings of the contents. I suppose I should give a brief description of what the terms <em>content </em>and <em>listing </em>mean.</p><p>At Trendyol, we use content terminology for templates of products, which means a content is not a sellable product but it contains a name, a description, many images, a brand, a category, etc. On the other hand, when we say listing, it means that a content is converted into a sellable product. A listing is dependent on a merchant, a boutique or both of them. For instance, while a Trendyolmilla red dress with a barcode XY12345 is a content, XL size of the content which is sellable with a price 50 TL in a Best Dresses boutique can be considered as a listing of that.</p><p><strong>Query Resolving</strong></p><p>Query resolving is an operation applied on our coming request so that we can split the search keyword into more meaningful parts. It is a basic Named-Entity Recognition (NER) process and after the process, we can gather words or phrases belonging to different classes such as gender, brand, category, attribute, variant, and so on. We use a recursive approach with a memoization step and a knowledge base for this classification. Let’s say, we have a search key “siyah dantel detaylı abiye milla elbise”. After the query resolving process, we get a result as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*XTk5LW3MVYCLJ2niuCOFZg.png" /></figure><p>This may be a simple process but it has lots of challenges. Normalization is one of the most critical issues as it has always been in NLP (Natural Language Processing) related topics. As our problem is mainly an information retrieval problem, we suffer from that drawback too. We apply a normalization process on both request and data so that we can have a match between them easily. For example, a user who wants to buy a US Polo branded product, we can see many different version of search keywords such as “us polo”, “Us. polo”, “us.polo”, “US POLO”, “U.S. POLO”, etc. In order to handle this issue and understand our user well, we have to match each version of the keyword with our source of truth version which is “U.S. Polo”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/0*9_SBKiQFn857lJuv" /><figcaption>Normalization</figcaption></figure><p>Another important challenge is stemming which is the keywords having one or more affixes may be in a very different form than their root forms. For instance, in Turkish, we have a grammar rule named softening of hard consonants (“p”, “ç”, “t”, “k”). These consonants change into soft consonants (“b”, “c”, “d”, “g”) when a vowel comes as a suffix to the word. Let’s say, we have a word named “kitap” and we bring “-ı” suffix after that. We get a result “kitabı” instead of “kitapı”. In such cases, we have to match “kitabı” with the data whose names include “kitap”. We benefit from an open source Turkish NLP library to convert surface forms of the words into their root forms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/0*CfbJHh2S-N5sBeDN" /><figcaption>Stemming</figcaption></figure><p>We have also some words and phrases that can have synonym words. For instance, considering the term “su ısıtıcısı”, we should match it with the requested word “kettle” as they point the same meaning, so the same product. We use a synonyms knowledge base for this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/0*G1Er8fxmy0Usi9mR" /><figcaption>Synonyms</figcaption></figure><p>We also make use of fuzzy search which is a meaningful process for mistyped search keywords. We use a customized Levenshtein (Edit Distance) Algorithm so that we can resolve our mistyping related issues.</p><p><strong>Search Strategies</strong></p><p>Now, we have several search strategies in our pipeline and each of them has been addressing an issue that we have faced so far. Probably, we will add more of them to our pipeline in the near future as we face off new challenges. While you can see names of the strategies we use as below, I cannot mention the way of their usage in the pipeline due to legal issues. If you want to learn more about them, you are welcomed to come and join us at Trendyol:)</p><ul><li>Default Search Strategy</li><li>Full-Text Search Strategy</li><li>Fuzzy Search Strategy</li><li>Category Search Strategy</li><li>Ancestor Category Search Strategy</li><li>Recommended Brand Search Strategy</li><li>Combinational Search Strategy</li></ul><p><strong>Search</strong></p><p>After a strategy is decided to be used, we build a special search query for it and filter the products in our search engine using that query. Actually, filtering can be considered as our simplest problem since our search engine, Elasticsearch, does almost all the work for us.</p><p>Now, suppose that we filter the products and give the results to our user. Let’s listen to him to understand if we can make him happy or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/0*2c3yrNgn_m0nsTSD" /></figure><p>As we see, the user is complaining about the number of products. They are too many to examine each of them and probably he is not happy with the first 100 products among 20K products. If we could have listed the products in better order, maybe we would have made our user happier. So, we need to sort our products in a smart way. This is called <em>relevancy</em>!</p><p><strong>Relevancy</strong></p><p>To give more relevant products to our users, we need a scoring mechanism. Our scoring function is a combination of two different sub-scoring modules which are product scoring and similarity scoring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/0*McmbbUcm2PBc5kRa" /></figure><p>Here, the <em>product score</em> is calculated based on only features of products. These features may be product information such as price, stock status, cargo type, brand and category as well as historical information such as sales count and view count. To calculate meaningful scores for each product, we use a supervised machine learning algorithm named Random-Forest Algorithm with the help of the data science team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*ejv0d9xV7CxtHxvl" /><figcaption>A random-forest subtree</figcaption></figure><p><em>Similarity score</em>, which is another parameter of our scoring function, is the text similarity measure between the search keyword and a few fields of a content we try to match with the search keyword. Since Elasticsearch is built on Lucene library, we can make use of TF/IDF similarity measure easily. It is the state-of-art technique in the information retrieval field and it can be formulated as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/0*A_wIoNe4vDeRR3wd" /></figure><p>Lucene also adds some extra features top of that including coordination between query and text, norms of them, and boosting capability which favors specific texts over others. While calculating the similarity score, we customize this extended classical approach with different weights for different fields and an n-gram model for favoring consecutive phrase match.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/0*Cy6GfszUEWh6F_QE" /></figure><p>After calculating the product score and the similarity score, we finally come up with the relevance score as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*7BBvJElsrxPEFD51bpCGiQ.png" /></figure><p>Now, we are able to list more meaningful products for our user. Let’s check whether he is happy now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NZ6Hycq9_GGKDiqT" /></figure><p>As we clearly see, he is still not happy with our results. So, we need to resolve these problems.</p><p><strong>Boosting</strong></p><p><em>Boosting </em>means making some products more valuable by adding or multiplying them with other factors that are not used in the scoring step. We benefit from two factors in order to boost products. While one of them is gender boosting, the other one is category boosting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/0*BtaRb-dVD0GaZdV1" /></figure><p><em>Gender boosting</em> is a clustering-like operation which splits products into two different groups and sorts each of them inside their own groups. After the process, we are able to list relevant women products for female users, and relevant men products for male ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/0*W_HT5bS7C3J1kZEv" /><figcaption>Search result for “gömlek” keyword typed by a male user</figcaption></figure><p>Finally, when we look at <em>category boosting</em>, it is a kind of boosting that favors a few weighted pre-defined categories over the rest for each search keyword. We use a correlation approach instead of clustering for category boosting as it should not split the products into a specific number of groups. Instead, it should distribute the weighted categories into the others somehow they can be relevant for the user’s request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/0*mVkFWJn-YOi64Qfi" /><figcaption>Search result for “iphone” keyword</figcaption></figure><p>After the boosting adjustment, we finally give the most relevant results for each of our users and resolve the problems they face off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/0*jiCO9d7QQNOTPw9F" /></figure><p>Our users are happy now. So are we!</p><p><strong>Invitation:</strong> This is an ongoing journey that we still carry on, and if you are passionate about our challenging work, <a href="https://jobs.lever.co/trendyol?department=Engineering%2C%20Technology%20%26%20Product&amp;team=Engineering">join us</a>!</p><p><strong>PS:</strong> If you are not familiar with the algorithms we apply on any process, you may have a look at them using the references listed below.</p><p><strong>References</strong></p><ol><li><a href="https://dzone.com/articles/the-levenshtein-algorithm-1">Levenshtein Algorithm</a></li><li><a href="http://www.wikizero.biz/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvUmFuZG9tX2ZvcmVzdA">Random-Forest Algorithm</a></li><li><a href="http://www.wikizero.biz/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvVGbigJNpZGY">TF/IDF Approach</a></li><li><a href="http://www.lucenetutorial.com/advanced-topics/scoring.html">Lucene Similarity</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7df2c59b4c9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/trendyol-search-behind-the-box-7df2c59b4c9a">Trendyol Search: Behind the Box</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>