[Bug 4428] Search sometimes fails in 0.19 and is generally less functional then 0.18

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
TedM
Posts: 128
Joined: Fri Apr 17, 2020 6:30 pm

[Bug 4428] Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby TedM » Thu Sep 03, 2020 6:41 pm

Code: Select all

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22284 (Git)
Build type: Release
Branch: master
Hash: bf1e8e48389f5e9e25bd77b67fe98da4213e797c
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
I've discovered that in some cases, search fails to find an object in the model tree. Also, search seems to be much more functional in 0.18, in that 0.18 search will find any substring while in 0.19, the substring must be rooted at the beginning of the name.

As a test, I went into the Part WB, created a cube and two cones and fused the cube and first cone.
search bug.jpg
search bug.jpg (6.13 KiB) Viewed 503 times
search bug.FCStd
(6.88 KiB) Downloaded 15 times
I then went to the model view, right-clicked the document name and clicked "Search...".

First, I did notice a difference in the general functionality of search: in 0.18, typing into the search box highlights all matching entries in the model view dynamically as you type. In 0.19 instead, the list of matches shows below the search box. Only once the typed string exactly matches the object name or the list is clicked will the object be highlighted. I assume this change is by design.

I did notice that case matters somewhat in 0.19: typing "Fusion" will highlight the object while typing it all lower case "fusion" will leave it listed below the search box and this must be clicked to highlight the object. In 0.18, search was completely case-insensitive.

In 0.18, typing "Cub" in the search box selects the "Cube" in the model view. in 0.19, typing "Cub" has no effect: nothing is shown matching. (Typing "Con" lists both cones.) However, finishing typing "Cube" will highlight the object. Typing "cube" will not match anything. I did discover by accident that typing "Bo" or "bo" will match a name "Box" and clicking it or finishing "Box" highlights the cube.

In 0.18, typing any substring highlights all matching entries in the model view. For example, typing "one" in the search box highlights both "Cone" and "Cone001". In 0.19, this shows nothing; typing "Con" instead lists both "Cone" and "Cone001".

The fact that you cannot search for a substring in the middle of a name is a serious functional regression from 0.18. The fact that some objects cannot be found with substrings at all seems like a downright bug.

I do remember seeing reports of a bug in auto-completing names in expressions which I cannot find currently. I'm wondering if this bug is related.

Also to note that I also have a older version of 0.19 which exhibits the same behavior so the bug seems to have been before that:

Code: Select all

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21125 (Git)
Build type: Release
Branch: master
Hash: 40600a55c2fe71ff589be677f6e427ccc937d003
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Last edited by TedM on Sat Sep 05, 2020 6:34 pm, edited 1 time in total.
chrisb
Posts: 29100
Joined: Tue Mar 17, 2015 9:14 am

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby chrisb » Fri Sep 04, 2020 5:46 am

I cannot confirm here, perhaps the handling has slightly changed, you have to finish using ENTER.
Setup: I have a model with Sketch and Sketch001. Search in Selection View

Search for "ke" finds both sketches but does not select them.
As soon as I hit ENTER both sketches are selected.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22284 (Git)
Build type: Release
Branch: master
Hash: bf1e8e48389f5e9e25bd77b67fe98da4213e797c
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
TedM
Posts: 128
Joined: Fri Apr 17, 2020 6:30 pm

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby TedM » Fri Sep 04, 2020 6:26 pm

chrisb wrote:
Fri Sep 04, 2020 5:46 am
I cannot confirm here, perhaps the handling has slightly changed, you have to finish using ENTER.
Setup: I have a model with Sketch and Sketch001. Search in Selection View

Search for "ke" finds both sketches but does not select them.
As soon as I hit ENTER both sketches are selected.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22284 (Git)
Build type: Release
Branch: master
Hash: bf1e8e48389f5e9e25bd77b67fe98da4213e797c
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
I just tried with Sketch and Sketch001. Typing "ke" in the search box had no effect. Then hitting ENTER also had no effect other than to close the search box; nothing was selected.

A Windows-specific bug? Seems unlikely. Could someone else on Windows please try this?
TedM
Posts: 128
Joined: Fri Apr 17, 2020 6:30 pm

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby TedM » Fri Sep 04, 2020 6:34 pm

I also tried resetting my configuration (by renaming the configuration directory) just in case. This had no effect.
Syres
Posts: 819
Joined: Thu Aug 09, 2018 11:14 am

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby Syres » Fri Sep 04, 2020 6:58 pm

TedM wrote:
Fri Sep 04, 2020 6:34 pm
I also tried resetting my configuration (by renaming the configuration directory) just in case. This had no effect.
I can confirm it was a regression introduced in August 2019 during the Big Merge and I've also tested @realthunder's latest LinkStage3 image and it doesn't work there either so maybe this is the first report. Personally, in the three years of using FreeCAD I've never needed it and I work on some reasonably complicated deep nested models but I can see why some may use it.

realthunder wrote: Interested to know if you are aware
Syres
Posts: 819
Joined: Thu Aug 09, 2018 11:14 am

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby Syres » Fri Sep 04, 2020 7:55 pm

Here's a crude Python macro to assist in the meantime:

Code: Select all

import FreeCAD as App
import FreeCADGui as Gui
from PySide import QtCore, QtGui
doc = App.ActiveDocument

class ObjectSearch():
    def __init__(self):
        self.dialog = QtGui.QDialog()
        self.dialog.resize(200, 100)
        self.dialog.setWindowTitle("Search Objects")
        la = QtGui.QVBoxLayout(self.dialog)
        t1 = QtGui.QLabel("Enter the text to Search Object Labels")
        la.addWidget(t1)
        self.s1 = QtGui.QLineEdit()
        self.s1.setText("")
        la.addWidget(self.s1)
        okbox = QtGui.QDialogButtonBox(self.dialog)
        okbox.setOrientation(QtCore.Qt.Horizontal)
        okbox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
        la.addWidget(okbox)
        QtCore.QObject.connect(okbox, QtCore.SIGNAL("accepted()"), self.proceed)
        QtCore.QObject.connect(okbox, QtCore.SIGNAL("rejected()"), self.close)
        QtCore.QMetaObject.connectSlotsByName(self.dialog)
        self.dialog.show()
        self.dialog.exec_()


    def proceed(self):
        if self.s1.text() == "":
            App.Console.PrintError("Enter some text to search for\n")
        else:
            for obj in doc.Objects:
                 objsearchtext = self.s1.text()
                 if objsearchtext.lower() in obj.Label.lower():
                         Gui.Selection.addSelection(doc.Name,obj.Name)
        self.close()

    def close(self):
        self.dialog.hide()

ObjectSearch()
Tested using:

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22319 (Git)
Build type: Release
Branch: master
Hash: 33ef4e0e35fba74c6e2fa3829cfd15c4b6f67e94
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
chrisb
Posts: 29100
Joined: Tue Mar 17, 2015 9:14 am

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby chrisb » Fri Sep 04, 2020 8:19 pm

Same on Ubuntu, it works. How do you search, with the View->Panels->SelectionView?

OS: Ubuntu 16.04.7 LTS (Unity/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: 3d6390bc938c17c21ce827f2b74986519c631ef9
Python version: 3.5.2
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
Syres
Posts: 819
Joined: Thu Aug 09, 2018 11:14 am

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby Syres » Fri Sep 04, 2020 8:32 pm

SearchMethod.jpg
SearchMethod.jpg (29.15 KiB) Viewed 415 times

Surely if there's an entry in the context menu it should work the same across builds otherwise we might as well remove it???


Last build I have working:

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17651 (Git)
Build type: Release
Branch: master
Hash: 16c26cb3b1cd7209ea8efc8cb30b3b18fd80cf95
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)

First build I have where it stopped working:

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17803 (Git)
Build type: Release
Branch: master
Hash: 89961a33d46063a43e9fb5b0308ca95d559eca94
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
chrisb
Posts: 29100
Joined: Tue Mar 17, 2015 9:14 am

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby chrisb » Fri Sep 04, 2020 8:42 pm

So it's a different search. Ted, as a workaround you can use SelectionView, it works as you expect the other search to be.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
chrisb
Posts: 29100
Joined: Tue Mar 17, 2015 9:14 am

Re: BUG: Search sometimes fails in 0.19 and is generally less functional then 0.18

Postby chrisb » Fri Sep 04, 2020 8:48 pm

I can narrow it down further around the big merge: it works in 17681 and fails in 17798.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17681 (Git)
Build type: Release
Branch: master
Hash: e94af7ff5e873f263cac51d7d47df68eca183250
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17798 (Git)
Build type: Release
Branch: master
Hash: 7e60631239109c632a8f6cca83f6e7e5502e43a1
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.