Answers.Body: <p>Lightswitch fields are a bit of an edge-case in searching because it can only be true/false (in the real boolean sense of true/false) so Craft doesn't explicitly index it in the searchindex table.</p>
  <p>That's a bit awkward because even through there is a field setting &quot;use this field's value for the search index&quot; it's the one field where it doesn't apply.</p>
  <p>Regardless, this should all be rectified for the upcoming Craft 4 release where we plan to make this possible.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-28T08:17:51.253Z
Answers.Text: Thank you Brad. In my case, I was primary looking for Lightswitch values that were TRUE and were returning nothing. In fact, the search index feature was disabled for this field, and you pointed it out. Now `fieldHandle:1` returns something. That's (almost) enough for me :)
Answers.UserDisplayName: Romain P.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-28T08:19:28.217Z
Answers.Text: Just one more thing: after enable the search index again for this field, `./craft resave/users` and `./craft resave/entries` had not the expected effect. The Lightswitch field values were still not indexed. I had to re-save manually these Entries to get the index up to date.
Answers.UserDisplayName: Romain P.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-27T21:52:22.387Z
Answers.LastActivityDate: 2020-08-27T21:52:22.387Z
Answers.UserDisplayName: Brad Bell
Body: <p>I tried these kind of searches in the CP search field (on top of the Entry list):</p>
  <ul>
  <li>fieldHandle:true / fieldHandle:false</li>
  <li>fieldHandle:1 / fieldHandle:0</li>
  <li>fieldHandle:* / -fieldHandle:*</li>
  <li>fieldHandle:not 1 / fieldHandle:'not 1'</li>
  <li>etc.</li>
  </ul>
  <p>Unfortunately, none of these returns the expected entries.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-27T19:01:07.340Z
Comments.Text: What version of Craft are you trying this on?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-27T19:28:26.857Z
Comments.Text: Craft Pro 3.4.30
Comments.UserDisplayName: Romain P.
Tags: <control-panel><search><lightswitch>
Title: Within the CP, how can I filter the listed Entries based on a Lightswitch field value?
ThreadText: # Within the CP, how can I filter the listed Entries based on a Lightswitch field value?
  
  (Asked by: username_0 on 2020-08-27)
  
  I tried these kind of searches in the CP search field (on top of the Entry list):
  
  * fieldHandle:true / fieldHandle:false
  * fieldHandle:1 / fieldHandle:0
  * fieldHandle:\* / -fieldHandle:\*
  * fieldHandle:not 1 / fieldHandle:'not 1'
  * etc.
  
  Unfortunately, none of these returns the expected entries.
  
  **Tags:** control-panel, search, lightswitch
  
  > **Comments:**
  > **username_1**: What version of Craft are you trying this on?  
  > **username_0**: Craft Pro 3.4.30  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-27. Score: 0
  
  Lightswitch fields are a bit of an edge-case in searching because it can only be true/false (in the real boolean sense of true/false) so Craft doesn't explicitly index it in the searchindex table.
  
  That's a bit awkward because even through there is a field setting "use this field's value for the search index" it's the one field where it doesn't apply.
  
  Regardless, this should all be rectified for the upcoming Craft 4 release where we plan to make this possible.
  
  > **Comments:**
  > **username_0**: Thank you username_1. In my case, I was primary looking for Lightswitch values that were TRUE and were returning nothing. In fact, the search index feature was disabled for this field, and you pointed it out. Now `fieldHandle:1` returns something. That's (almost) enough for me :)  
  > **username_0**: Just one more thing: after enable the search index again for this field, `./craft resave/users` and `./craft resave/entries` had not the expected effect. The Lightswitch field values were still not indexed. I had to re-save manually these Entries to get the index up to date.  
  
  ---
  
  