Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug search keeps resetting scope

Discussion in '2022.2 Beta' started by laurentlavigne, Aug 16, 2022.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    upload_2022-8-16_14-3-36.png
    then
    upload_2022-8-16_14-3-43.png
    esc

    ctrl+space
    and it's back to project

    upload_2022-8-16_14-4-5.png
     
  2. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi! Do you have focus in the Project Browser's search field by any chance? If you have focus in the Project Browser's search field or the Scene Hierarchy's search field, then using the "Main Menu/Edit/Search All" shortcut will open Search in their respective tabs, regardless of where it was when it was last closed. If you reopen Search without any focus or by using the Global Search icon, it will reopen with the previous "global" state.
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    No.
    do you think it's better like that?
     
  4. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    This was done deliberately to be used in conjunction with the "sync" feature. However, if sync is off, maybe we shouldn't force the view state.

    With that said, I'm not sure why in your case this would behave like that. On my end the view state is properly restored in 2022.2.0b4. I'm assuming that "Ctrl+space" is your shortcut for Global Search ("Main Menu/Edit/Search All")?
     
  5. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    Definitely.
     
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    Also if you could fix the show tab resetting that'd be extra space for the list.
    Where is the sync option?
     
  7. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    First, you have to set the search engines for Project or Scene to "Advanced":
    upload_2022-8-26_10-35-59.png
    Then, when you open Search, you should see an icon in the tab bar that allows you to toggle "Sync" on and off:
    upload_2022-8-26_10-50-4.png
    However, I just realized that the same issue happens with this option for Project and Scene search, i.e. it is forced enabled when we open Search from the Project Browser or the Scene's search field. We should add an option to enable/disable the forced view state for those scenarios.

    But that still doesn't explain why your state doesn't get restored properly when you open the global search. Do you have the same issue when using the global search icon, or just your shortcut?
     
  8. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    I see, that's interesting. Do you have a video showcasing the benefit of contextual search like that? Within a production off course because as your speed goes up implicit things get in the way. Even with the syn off (it doesn't persist, it should to be consistent with unity behavior or toggles)
    Now, I am sure you will fix that non persistence of sync toggle.
    But here is my comment on what you are trying to do: instead of pushing for use of the massive search window for advanced queries, could you instead make accessible those queries inside the imbedded search field?

    I had mapped the contextual search instead of search all by mistake.

    Now that this is search all, ctrl+space calls the search all tab unless a search field is editing
     
  9. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Sorry, we don't have any video for that.
    This is what setting the "Search engine" to "Advanced" does. It lets you use the same powerful search as the Search window within the Project Browser or the Scene Hierarchy. You don't have to open the Search window or use the Sync option. It's there if you wish to use it for any reason, like loading a saved search query or using the Query Builder to build your query.
    Glad to hear that you were able to make it work!
     
  10. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    nice! auto wildcard type. Advanced should be the default, why is it not?
    upload_2022-8-29_16-19-36.png
     
    mahdi_jeddi likes this.
  11. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    "Advanced search" (ie. QuickSearch) requires a search cache to be built, and performs a bit worse than the old one. It's also got this really annoying property where it goes "there's no results for your search" while what it really means it "we're still waiting for the background search thread to finish searching".

    So there are some reasons to still use the old one.
     
    laurentlavigne and mahdi_jeddi like this.
  12. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    There was a lot of backlash when we did enable it by default (I don't remember if it was just internally or not), so we reverted that change.
     
    laurentlavigne likes this.
  13. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    @sebastiengrenier you got this?

    Got the notes on that? I'm interested in all things UI/behavioral
     
  14. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    This will be fixed in 23.1. We updated what we call the "Empty View" to be more explicit of what is going on, i.e. search is still in progress, indexing is in progress, there really are no results, etc. It will also provide more help when there is no result, such as giving you some hints on options you could enable to get more results.

    I don't have any to show, but from what I remember the consensus was "don't change the behavior of what is already working." By default, the "Advanced" engine (Search) will give more results for a given query than what you would expect from the Project Browser or the Scene Hierarchy. People were not happy with this, which is understandable. So we reverted the default engine until further notice.
     
  15. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    It makes sense and it's good that you want to not perturb muscle memory, but then why did you add this button?
    upload_2022-9-1_13-18-40.png
     
  16. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    This is opposite to my experience - it returned less results.
    • The hierarchy search box wouldn't show results from the DontDestroyOnLoad scene
    • The object picker would prepopulate the query with the entire namespace of the type of object (t:MyNamespace.MyClass) and would return zero results. You'd have to manually change it to t:MyClass to get any hits.
    • The project search box would work, mostly, until sometimes the index was busy being rebuilt in which case it returned a mix bag of results. So it felt completely unreliable - I'd search for something "UIWindow" - and I'd get 3-4 hits. Something feels off. I wait a little, and search again, and get my expected number of results. Sometimes I get no hits.
    • It also slowed down search results considerably. Not seconds of time, but enough time to make it feel very sluggish and slow. Searching project for a simple string felt like a heavy operation.
    • The constant index scanning/regeneration slows down the editor considerably, and can take a long time to resolve.
    • This is Unity 2021 LTS
    Lots of great ideas with the new search system. But its too slow/heavy and does not fill me with faith with the results it returns. (index is constantly in flux and outdated, and so are the results).

    I trust the legacy search because I know it will definitely find everything in the project for the given query, if it is a query it supports. (name search, search by type, etc).

    Baste touched on this last point. The new search presents the results of the query as if it is definitive - No results found! but in reality, there might actually be results - its just waiting for the index to build. I just can't put any faith in it!
     
  17. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    This button was added with the sync feature. However, even if your search engine is the default one (i.e. not advanced), the idea was that you can still use it to open search with the current query if you don't find what you are looking for. If this is annoying to you and would like it gone, then this is something that will have to be brought to the design team.

    Sorry, I totally misspoke. I should have said *different* results. In our experiments, most of the times it was more, but it can also be less. It really depends on your search indexes.

    For your issues, you should open some tickets. We are aware that there are some issues with indexing (i.e. the slow times), but it shouldn't be constantly re-indexing unless you are constantly modifying your assets.
     
    Prodigga likes this.
  18. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    I never use that, anyone? Seems like power user workflow which shouldn't take up space, there is a shortcut for it as we've seen.
    If you could do it that's be great.
     
  19. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    After having used advanced for a few weeks now and with the project growing in asset# I know why it's not default: it's much slower than builtin.
     
  20. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Hi Laurent, can you elaborate what is slower? Project Search? Hierarchy?

    We have tested in really big projects (more than 500K assets) and usually the search window stays responsive while searching for assets while the project window using the legacy search freezes the ui.

    If you give me more details, I can benchmarks the workflows you found slower.

    Thanks,

    Sebastien

     
  21. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    This one.
    I don't know how many assets I have. Advanced is noticeably slower whereas classic is instant. Note that I use 10ms debounce threshold.
     
  22. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    On my side, searching for eg. t:SomeClass is instant in project view, always. The first time I boot QS after opening, it takes a few seconds to get itself ready to show anything. Any recompile or minor asset change makes it not give the correct results for a little bit as well.
     
    laurentlavigne likes this.
  23. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    I will try to produce benchmark for some projects we have. Like Laurent is saying, we know modifying something as "known" as the PRoject Window search is risky. Hence why Advance Search is still an option and not default.

    That said, in a mid term future we would like to unify all search workflow under the Advance Search backend. So we need proof that feature wise and perf wise it is at least equivalent.

    Thanks Baste and Laurent for taking time to give your feedback. It is always really appreciated.

     
  24. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    Anything that can help, we spend a LOT of time in search.
    And if you could please push a fix to the sync-off ignore bug... I keep typing stuff then look for spelling mistake because the list is empty only to realize that it's on some tab instead of all.
     
  25. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Just to update what I'm trying to say above, what's happening a ton with Quick Search is this:

    - I open Quick Search and search for a prefab, and get a result fairly quickly
    - I make any code change
    - I open Quick Search and search for the exact same thing
    - Quick Search spends 5+ seconds spinning showing "no results" before it finds the old thing

    My code change didn't in any way change the thing I searched for.

    So there's a bug where Quick Search has realized that there is some change in some asset, and because of that fails to find any results whatsoever. I assume that this is to avoid the window hanging, but being responsive and not showing any results is almost just as bad as hanging.

    There's only two real solutions where QS is good enough to replace the default search:
    - it's so fast at updating the database that my above problem isn't noticeable
    - It's able to show results from the un-updated index while the index is updating, without that causing hangs.
     
  26. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    This is something that we will be investigating. From memory, when we do indexing, we still rely on the "old index" and we swap the old index with the new one only when indexing is fully done. This swapping shouldn't take much time. 5s of having the no results window is a long time :(



     
  27. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Yeah, it for sure doesn't look like it's able to use the old index during indexing. It's at least not showing results that used to be there!

    Does the old index live in memory? Ie. could it be that since there's been an assembly reload, the required data's been evicted? The assembly QS lives in shouldn't have been reloaded, but there might be a safety feature where you're ditching data since some of it might not be valid anymore with the new data?