# Excluding certain entries from search results

**URL:** <https://onehack.st/t/excluding-certain-entries-from-search-results/189894>\
**Category:** Discussion & Solutions\
**Tags:** solved\
**Created:** [June 16, 2021, 6:51pm UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894 "2021-06-16T18:51:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miscell](https://onehack.st/user_avatar/onehack.st/miscell/32/49941_2.png) [@Miscell](https://onehack.st/u/Miscell)\
**Post date:** [June 16, 2021, 6:51pm UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/1 "2021-06-16T18:51:05Z")

</div>

Hello 1Hackers,

I always comeback here to look for solutions whenever I’m stuck online & this community never disappoints.😄

Please help me solve this. I want search results of (say) only Zomato keyword in the link shared below & at the same time I want to exclude any entries that has swiggy in search result. How can we make it Possible?

[https://www.olx.in/items/q-Zomato?isSearchCall=true](https://www.olx.in/items/q-Zomato?isSearchCall=true)

---

<div class="post-metadata">

**Author:** ![Darth\_Vader](https://onehack.st/user_avatar/onehack.st/darth_vader/32/97002_2.png) [@Darth\_Vader](https://onehack.st/u/Darth_Vader)\
**Post date:** [June 16, 2021, 7:15pm UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/2 "2021-06-16T19:15:12Z")

</div>

What exactly do you want the search result to show?

---

<div class="post-metadata">

**Author:** ![Miscell](https://onehack.st/user_avatar/onehack.st/miscell/32/49941_2.png) [@Miscell](https://onehack.st/u/Miscell)\
**Post date:** [June 17, 2021, 2:10am UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/4 "2021-06-17T02:10:11Z")

</div>

All search results of Zomato but without the keyword swiggy in it & also what if I want to exclude one more keyword along with swiggy?

---

<div class="post-metadata">

**Author:** ![imanseptian](https://onehack.st/user_avatar/onehack.st/imanseptian/32/79904_2.png) [@imanseptian](https://onehack.st/u/imanseptian)\
**Post date:** [June 16, 2021, 11:22pm UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/3 "2021-06-16T23:22:09Z")

</div>

Put it in search engine:  
site:olx.in zomato -swiggy

---

<div class="post-metadata">

**Author:** ![Darth\_Vader](https://onehack.st/user_avatar/onehack.st/darth_vader/32/97002_2.png) [@Darth\_Vader](https://onehack.st/u/Darth_Vader)\
**Post date:** [June 17, 2021, 5:14am UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/5 "2021-06-17T05:14:33Z")

</div>

Olx’s search engine doesn’t have any options or shortcuts to do that.

---

<div class="post-metadata">

**Author:** ![Miscell](https://onehack.st/user_avatar/onehack.st/miscell/32/49941_2.png) [@Miscell](https://onehack.st/u/Miscell)\
**Post date:** [June 17, 2021, 5:38am UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/6 "2021-06-17T05:38:26Z")

</div>

Exactly. So how can we achieve it? Is it possible to add something In URL which leads us to our desired results?

---

<div class="post-metadata">

**Author:** ![Jay\_Patel](https://onehack.st/user_avatar/onehack.st/jay_patel/32/15813_2.png) [@Jay\_Patel](https://onehack.st/u/Jay_Patel)\
**Post date:** [June 17, 2021, 6:22am UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/7 "2021-06-17T06:22:11Z")

</div>

I quickly wrote a script which might fulfill your need somewhat

 ![image](https://onehack.st/uploads/default/original/3X/9/8/98edb5eac551e7792bf2331d2538f97e4bfd4f9d.jpeg)

```auto
const ulElement = document.getElementsByClassName('rl3f9 _3mXOU')[0];
liElements = ulElement.querySelectorAll('li');
liElements.forEach((item) => {
    const itemTitle = item.querySelector('._2tW1I');
    if(itemTitle) {
        const titleText = itemTitle.textContent.toLowerCase();
        const includeWords = ['apple'];
        const excludeWords = ['philips'];
        let result = excludeWords.some(word => titleText.includes(word))
        if(result) { return }
        result = includeWords.some(word => titleText.includes(word))
        if(result) { console.log(itemTitle.textContent); }
    }
})

```

Update adding this will also remove the node you don’t want

```auto
let result = excludeWords.some(word => titleText.includes(word))
if(result) {
    item.remove()
    return 
}

```

I have not test if the script works properly so if some error come pm me.

---

<div class="post-metadata">

**Author:** ![Miscell](https://onehack.st/user_avatar/onehack.st/miscell/32/49941_2.png) [@Miscell](https://onehack.st/u/Miscell)\
**Post date:** [June 17, 2021, 8:10am UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/8 "2021-06-17T08:10:06Z")

</div>

Appreciate your hard work. I haven’t tested either. Actually I missed to mention that I want this filteration to happen on my mobile. Can you help?

---

<div class="post-metadata">

**Author:** ![Darth\_Vader](https://onehack.st/user_avatar/onehack.st/darth_vader/32/97002_2.png) [@Darth\_Vader](https://onehack.st/u/Darth_Vader)\
**Post date:** [June 17, 2021, 8:48am UTC](https://onehack.st/t/excluding-certain-entries-from-search-results/189894/9 "2021-06-17T08:48:13Z")

</div>

If you are using chrome, execute that script and save that page as a link in a txt file or just close it and then reopen that page from chrome on your mobile. Or better yet send that page to your mobile by clicking →

 ![image](https://onehack.st/uploads/default/original/3X/9/9/99de6d855ac29720b5822a88eb6806d97d7804b8.png)  
and then scan it on your phone.
