# Explicit Search in Pi-hole Admin Console

**URL:** https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893
**Category:** Implemented
**Tags:** investigating
**Created:** [February 28, 2020, 9:07pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893 "2020-02-28T21:07:03Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![peruster](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/peruster/32/13055_2.png) [@peruster](https://discourse.pi-hole.net/u/peruster)
#### Post date: [February 28, 2020, 9:07pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/1 "2020-02-28T21:07:03Z")

</div>

When using the Query Log Search field, I can't seem to search explicitly, even with quotation marks. For example I want to filter/search for IP 10.0.1.6, but instead I'm getting 10.0.1.6\*, where the \* is all other numbers as well.

Is there a way to do this through the admin console or must I use the terminal? Thanks.

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [February 28, 2020, 9:12pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/2 "2020-02-28T21:12:51Z")

</div>

> [@peruster](#):
>
> I want to filter/search for IP 10.0.1.6, but instead I’m getting 10.0.1.6\*

Are you seeing all the other IP's, or only those IPs that lead with 10.0.1.6 (i.e. 10.0.1.6, 10.0.1.61, etc.).

---

<div class="post-metadata">

### Author: ![peruster](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/peruster/32/13055_2.png) [@peruster](https://discourse.pi-hole.net/u/peruster)
#### Post date: [February 28, 2020, 9:27pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/3 "2020-02-28T21:27:55Z")

</div>

Just ones that lead with 10.0.1.6, so for example 10.0.1.69 and 10.0.1.6

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [February 28, 2020, 9:41pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/4 "2020-02-28T21:41:27Z")

</div>

This is normal and the same thing I see.

 ![image](https://discourse.pi-hole.net/uploads/default/original/2X/f/fd84734d273dca1cfa42be26e6dd835c32887bd3.jpeg)

 ![image](https://discourse.pi-hole.net/uploads/default/original/2X/5/5d9032af08a71bb80f65abc8546121b38ee8bc7c.jpeg)

 ![image](https://discourse.pi-hole.net/uploads/default/original/2X/f/f777847984881f5b90123e5f1a8639c5273ec150.jpeg)

You can avoid this by mapping IPs to client names in either /etc/hosts or in a new configuration file in /etc/dnsmasq.d

 ![image](https://discourse.pi-hole.net/uploads/default/original/2X/a/a5d2312f54b26b97a7639d6fd27ac2f1bd24695d.jpeg)

Or, from the CLI, you can search the query log with `grep "10.0.1.6" /var/log/pihole.log`

---

<div class="post-metadata">

### Author: ![DanSchaper](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/danschaper/32/91_2.png) [@DanSchaper](https://discourse.pi-hole.net/u/DanSchaper)
#### Post date: [February 28, 2020, 9:47pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/5 "2020-02-28T21:47:11Z")

</div>

It's the current behavior but I wouldn't say it's normal. A search for 192.168.0.1 should return just that IP and not 192.168.0.121.

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [February 28, 2020, 9:48pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/6 "2020-02-28T21:48:11Z")

</div>

> [@DanSchaper](#):
>
> It’s the current behavior but I wouldn’t say it’s normal.

I'll agree with that. My comment was poorly worded and I intended it to mean that the OP's Pi-hole was not malfunctioning.

---

<div class="post-metadata">

### Author: ![peruster](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/peruster/32/13055_2.png) [@peruster](https://discourse.pi-hole.net/u/peruster)
#### Post date: [February 28, 2020, 9:51pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/7 "2020-02-28T21:51:12Z")

</div>

Well take it into suggestion then, thanks. And great work anyway you look at it ;).

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [February 28, 2020, 9:53pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/8 "2020-02-28T21:53:51Z")

</div>

I converted the post to a feature request.

---

<div class="post-metadata">

### Author: ![DanSchaper](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/danschaper/32/91_2.png) [@DanSchaper](https://discourse.pi-hole.net/u/DanSchaper)
#### Post date: [March 29, 2020, 4:53pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/11 "2020-03-29T16:53:47Z")

</div>

[https://github.com/pi-hole/AdminLTE/issues/1196](https://github.com/pi-hole/AdminLTE/issues/1196)

---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [April 10, 2020, 9:05am UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/12 "2020-04-10T09:05:09Z")

</div>

> [@DanSchaper](#):
>
> It’s the current behavior but I wouldn’t say it’s normal. A search for 192.168.0.1 should return just that IP and not 192.168.0.121.

Well, everything the on-click does is copying the current text into the search box on the top right. Would you like to change the search behavior to need to be exact? I'm pretty sure we'll loose more functionality than we get.

For instance, you can now type: `google` and the search result will be all domain containing `google` somewhere in their name.

If we change this to exact search, such a thing will not be possible any more. For instance, using our "smart" search algorithm, you can currently put multiple constraints at the same time, e.g.,

 ![Screenshot from 2020-04-10 11-03-01](https://discourse.pi-hole.net/uploads/default/original/2X/5/5e6aea5f0c5e57b7274d1075ef43141be7bd2956.png)  
where I searched for a client + domain contribution. Both only in parts.

However, I'm always open for ideas and happy to try and discuss them with you.

---

<div class="post-metadata">

### Author: ![yubiuser](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yubiuser/32/12100_2.png) [@yubiuser](https://discourse.pi-hole.net/u/yubiuser)
#### Post date: [April 11, 2020, 7:14pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/13 "2020-04-11T19:14:05Z")

</div>

I suggest a combination:

Let your smart search algorithm understand quotation marks as exact search. On click on type/domain/client (with filtering activated) add quotation marks to the search string to make it exact too. This would solve the above query log client sort issue as I would guess most users expect an exact search when they click on one of those fields.

This way you won't loose the flexibility of the current implementation but add the ability for exact search and change the default (and expected?) on-click behavior.

---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [April 13, 2020, 1:17pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/14 "2020-04-13T13:17:47Z")

</div>



---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [April 21, 2020, 9:20am UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/16 "2020-04-21T09:20:30Z")

</div>

I added some improvements to the Query Log page (no other page so far, this is only for testing the behavior).

Please try

```auto
pihole checkout web tweak/exact_searching

```

What I did was decoupling filtering and searching as this made things cleaner. As it is not immediately obvious what is now being filtered on, we show this in the reset button.

What you can do now is:

1. Click on an item (query type, domain, client) to filter _exactly_ on this item (clicking on `github.com` will **not** show `collector.github.com`)  
 ![Screenshot from 2020-04-21 11-21-08](https://discourse.pi-hole.net/uploads/default/original/2X/2/2fba658d4d42e2d98857a3c51c11d144f9f74aa3.png)  
Probably a better example is that clicking on `A` doesn't show any `AAAA` queries any longer:  
 ![Screenshot from 2020-04-21 11-21-27](https://discourse.pi-hole.net/uploads/default/original/2X/c/cf24de1bbdaf0d355bda8414e0bc594a84800292.png)
2. You can **combine** filtering when you **hold** `[Ctrl]` when clicking, the reset button text will again tell you what you did:  
 ![Screenshot from 2020-04-21 11-11-12](https://discourse.pi-hole.net/uploads/default/original/2X/c/c6c314b1da54f11fa8d8f92588bdb81020e9ab21.png)  
It is possible to add the same field multiple times to the filter, this will cause no issues, even when it doesn't make too much sense:  
 ![Screenshot from 2020-04-21 11-14-35](https://discourse.pi-hole.net/uploads/default/original/2X/5/5d4d4eab4f445148607a2963d1f6defc2f51073c.png)
3. Searching works **on top** of this filtering, for instance, you can still get all `*.github.com` requests from an exact filtering on a specific client by clicking on the client and then entering `github` into the search field:  
 ![Screenshot from 2020-04-21 11-16-38](https://discourse.pi-hole.net/uploads/default/original/2X/c/ce81c9698c6cda727e74ae778c095bc79171d579.png)
4. Clearing the filtering does not empty the search field any longer as filtering is now separate from searching.

Testing would be highly appreciated as such a fundamental rewrite is likely to have some side-effects I have not yet considered.

**edit** : I already added the missing space in front of the `and` in the button seen in the screenshots above.

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [April 21, 2020, 3:00pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/17 "2020-04-21T15:00:12Z")

</div>

> [@DL6ER](#):
>
> You can **combine** filtering when you **hold** `[Ctrl]` when clicking, the reset button text will again tell you what you did:

I cannot get this to work on any Mac browser. The OS or browser intercepts the Ctrl key combination with popups. Works fine on a PC. I tried alternate key combinations on the Mac with no success.

Firefox Mac:

 ![image](https://discourse.pi-hole.net/uploads/default/original/2X/7/7c1419d87f790cd20562dc9c18b88ac4696d79e6.jpeg)

Safari Mac or Chrome Mac (same behavior):

 ![image](https://discourse.pi-hole.net/uploads/default/original/2X/e/e45b52c89d0fbf51901f3a3a971c4e22862d6f5a.jpeg)

---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [April 22, 2020, 6:38am UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/18 "2020-04-22T06:38:56Z")

</div>

> [@jfb](#):
>
> I tried alternate key combinations on the Mac with no success.

Interesting. I have no Mac devices to try this. I can add a Mac specific key modifier as well, I wasn't aware of a special meaning of Ctrl on a Mac. What would be the equivalent (which key to hold down when selecting multiple elements)?

**edit** Google told me (searched for "Mac select multiple"):

> **Select multiple** items: Press and hold the **Command key** , then **click** the items.

There are several SE posts about that this "Command key" cannot be captured reliably. Could you please try whether it works for you in all browsers you have available on your Mac?

> **[JS Bin](https://jsbin.com/huyifahuru/edit?js,output)**
>
> A live pastebin for HTML, CSS & JavaScript and a range of processors, including SCSS, CoffeeScript, Jade and more...

---

<div class="post-metadata">

### Author: ![yubiuser](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/yubiuser/32/12100_2.png) [@yubiuser](https://discourse.pi-hole.net/u/yubiuser)
#### Post date: [April 22, 2020, 8:23am UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/19 "2020-04-22T08:23:56Z")

</div>

Nice work!  
I tested it on Linux/Chrome+Firefox and everything works.

I'm nor sure if I'm total happy with decoupled filtering/searching. I't makes searching/filtering kind of complicated to understand what does what. It was intuitive before when the "filter" tag showed up in the search field and could be deleted from there as well.  
I'll think about a way to improve that.

One additional thing concerns the "multiselection". From the wording used ("use Ctrl + click for multi-selections") I would expect to hold Ctrl and select multiple things and apply the filter on Ctrl release. If such behavior is impossible to code (or not desired) I suggest to change wording to "use Ctrl + click to add selection". That would make it clearer that it is a multi-step process.

---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [April 23, 2020, 6:38am UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/20 "2020-04-23T06:38:30Z")

</div>

> [@yubiuser](#):
>
> I suggest to change wording to “use Ctrl + click to add selection”.

Okay, I'll do this. It is neither the intended behavior nor easy to implement this other interpretation.

> [@yubiuser](#):
>
> It was intuitive before when the “filter” tag showed up in the search field and could be deleted from there as well.

That's why I put the text on the button. If you find this too discreet, another idea would be to color-highlight the columns filtering is applied on.

I did look for possible ways to achieve this, however, modifying the search algorithm in a way to change the meaning of `""` is not possible without modifying the vendor code directly. That is because `""` already has a special meaning for Datatables as in:

- `Alice Bob` matches `Alice and Bob`, however,
- `"Alice Bob"` does not match `Alice and Bob`.  
(only a space is allowed to be in between `Alice` and `Bob`)

However, any modification to the vendor-provided file ([this one](https://github.com/pi-hole/AdminLTE/blob/release/v5.0/scripts/vendor/jquery.dataTables.min.js)) would likely be overwritten when someone wants to update this file by simply replacing it with a more recent version. There is no way we could get this working in a reliable fashion. Maybe with our own fork of DataTables, but that is making things way too complicated.

---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [April 23, 2020, 7:19am UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/21 "2020-04-23T07:19:20Z")

</div>

@jfb I added the Meta key modifier. Please test the most recent version on your Mac.

* * *

It should now be even clearer which columns causes filtering:

 ![Screenshot from 2020-04-23 09-14-53](https://discourse.pi-hole.net/uploads/default/original/2X/0/0f7a8c8e404a828069949a77c6cdf5a1003b8a54.png)

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [April 23, 2020, 1:14pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/22 "2020-04-23T13:14:37Z")

</div>

It works on a Mac with the command key and a click. We might want to change the wording on the Apply Filtering box from:

`... (use Ctrl + click to add elements to the current selection)`

to

`... (use Ctrl + click [or the equivalent in your OS] to add elements to the current selection)`

---

<div class="post-metadata">

### Author: ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)
#### Post date: [April 23, 2020, 1:25pm UTC](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893/23 "2020-04-23T13:25:20Z")

</div>

It is already a quite bulky text. However, users will likely not find it in this case, what do you think?

How about

> (use Ctrl/⌘ + to add elements to the current selection)

?

**edit** Maybe even:  
 ![Screenshot from 2020-04-23 15-33-37](https://discourse.pi-hole.net/uploads/default/original/2X/e/ea1cda0e5009a1842737d99784aaede9e6936022.png)

[Next page](https://discourse.pi-hole.net/t/explicit-search-in-pi-hole-admin-console/28893.md?page=2)
