Page MenuHomePhorge

Allow to query Tasks with a custom boolean field set to false
Open, LowPublic

Description

Steps to reproduce:

  • define a searchable custom field boolean
  • go to the search page

Example definition:

"our.customfield": {
    "name": "Supportfall",
    "type": "bool",
    "search": true
  }

What happens

At the moment you can only skip the filter, or require a true value:

phorge_boolean.png (353×648 px, 11 KB)

What should happen instead

Allor to filter by "not true". That is: the elements that does not have that to true.

Resources


Previous discussion:

Q23: Query tasks with a custom boolen field set to false

Event Timeline

valerio.bozzolan triaged this task as Low priority.
valerio.bozzolan created this object in space S1 Public.

I've honestly tried to work on this and I discovered that it's not that obvious:

At the moment it seems it internally filters by "1" for true.

But, it cannot just filter by "0" for false: it does not get any result. This probably means that true is saved as "1" and false is saved as NULL.

I will retry later searching by NULL.

But, it cannot just filter by "0" for false: it does not get any result. This probably means that true is saved as "1" and false is saved as NULL.

I will retry later searching by NULL.

I believe that distinguishing 3 states for a boolean field (undefined,false,true) might be technically a clean solution in the low level implementation, but actually it seems right to me to interpret 'undefined' and 'false' both as false.

However, the logic issue seemsto be that since false and undefined both are interpreted in the same way, possibly the low level function gets confused and interprets "false" as "field is not defined" . However on the high level (UI) we can only select "required" which then unintentionally hides all fields which are correctly set to false. So we can not search for them.

For me it looks like there is something missing on the higher level (user interface) where we either need to be able to search technically correct for 3 distinct states (true,false,undefined) or practically sufficient search for 2 states (true,false) where undefined fields are included as set to false when we search for false value.

Interesting how a boolean can make fuzz :)

Interesting. It's still unclear to me how to filter by "undefined". That would be still a partial success in my brain.

I don't know why but, in my local installation, I'm able to set the filter to "Require" and then see a Task that does NOT have this flag enabled. I don't know if my computer is fucked up or something.

OK the thing is:

  • Create a Task with that flag as true
  • Unflag and Save

→ Now that Task is shown even if you filter with "Require" (this is true to me using MySQL)

Can you reproduce?

It seems it runs this query:

SELECT `task`.*  FROM `maniphest_task` task JOIN `maniphest_customfieldnumericindex` `appsearch_0` ON `appsearch_0`.objectPHID =
`task`.phid
              AND `appsearch_0`.indexKey = 'zCmfatcZ3Gly' WHERE ((`task`.spacePHID IS NULL) AND ((`appsearch_0`.indexValue IN
(1))))   ORDER BY `task`.`priority` DESC, `task`.`id` DESC LIMIT 101

If I'm inspect that specific Task:

$ SELECT * FROM maniphest_customfieldnumericindex WHERE maniphest_customfieldnumericindex.objectPHID = 'PHID-TASK-la7uhrmo3m53auqjq7ud'; +----+--------------------------------+--------------+------------+
| id | objectPHID                     | indexKey     | indexValue |
+----+--------------------------------+--------------+------------+
| 39 | PHID-TASK-la7uhrmo3m53auqjq7ud | zCmfatcZ3Gly |          1 |
+----+--------------------------------+--------------+------------+

Also:

$ SELECT * FROM maniphest_customfieldstorage WHERE objectPHID = 'PHID-TASK-la7uhrmo3m53auqjq7ud';
+----+--------------------------------+--------------+--------------------+
| id | objectPHID                     | fieldIndex   | fieldValue         |
+----+--------------------------------+--------------+--------------------+
| 47 | PHID-TASK-la7uhrmo3m53auqjq7ud | B46b2hqdrB7v | mycompany:engineer |
| 46 | PHID-TASK-la7uhrmo3m53auqjq7ud | zCmfatcZ3Gly | 0                  |
+----+--------------------------------+--------------+--------------------+

Hi @Higgs are you still sure that this thing ever really worked?

Try to:

  • Create a Task with that flag as true, save
  • Unflag and Save

It appears in Require search results, to me. And it really should not.

aklapper renamed this task from Allow to query Tasks with a custom boolen field set to false to Allow to query Tasks with a custom boolean field set to false.May 1 2023, 20:16