Search Unity

Official Quick Search Preview

Discussion in 'Editor Workflows' started by benoitd_unity, Feb 26, 2019.

  1. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hmm yeah the new way of indexing asset is dependant on the ADB V2. I could always try to add some fallback indexing if ADB V2 is not enabled. I didn't thought of that at first :( I thought is was the default now.

    Sorry about that, I'll try to think a way to support both. Using ADB V2 it allow us to index in the background preventing any UI stalls and allowing you to continue working while the indexing is running. A fallback I could provide would be to force the indexing at import time, but that would make the importation take more time and blocking the UI while indexing. Would that be a good enough solution for your team?

    Another solution would be to turn indexing off and fallback on a simpler asset paths search, similar to what you can do in the project browser search field.
     
    00christian00 likes this.
  2. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    The current behaviour is indexing on the first time,right? I think the current one is ok for me, it takes few minutes.
    Is the new version indexing much more data and thus be slower?
     
  3. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    It really depends on the options you select. The more options you select, the bigger the index will and the more time it will take to run the indexing.

    upload_2020-7-22_12-57-10.png

    The option Dependencies is the one that makes the index the bigger and that takes the most time to compute.

    I'll do a hot fix for ADB V1 and send you the package so you can test it locally.
     
    00christian00 likes this.
  4. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hi there,

    I've noticed Quick Search doesn't seem to be working so well for me recently. I'm on 2.02 in Unity 2019.4. It just seems that I almost have to put in the exact item name and I have to do a lot of scrolling through to get to the file I'm trying to find. I thought it used to be a little looser?
    Was there some way of marking files you search for often so they appear at the top of the list?

    Thanks,
    Pete
     
  5. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi petey,

    Which version were you using previously? Are you using the new .index files? Also if you are getting too much noise, you can open the filter window and un-check "Show all results..."

    upload_2020-7-23_9-6-40.png

    Also recent items were removed, because many users reported they didn't like that feature.
     
    Last edited: Jul 23, 2020
  6. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi Christian,

    We had to disable search indexes with ADB V1 (since it is deprecated in 19.4), that said you should still be able to search asset file paths (using words, regex and simple glob patterns).

    So in a project using ADB V1 you can remove .index files otherwise you'll get

    upload_2020-7-23_9-27-23.png

    You'll still be able to search asset using the Asset or Find Files search providers:

    upload_2020-7-23_9-28-26.png

    upload_2020-7-23_9-29-45.png

    upload_2020-7-23_9-30-28.png

    So basically, when searching without indexes, you are losing searching assets with property filters (i.e. width>=1024). You should eventually try to migrate to ADB V2 if possible.

    You can grab Quick Search 2.1.0-preview.2 here https://drive.google.com/file/d/1EVUnLA5x2YltMI8CgXrG-h2m7kXxwRk3/view?usp=sharing
     
    00christian00 likes this.
  7. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Thanks, maybe I'll try again adb v2 when I have some free time to see if things got better but it wasn't long ago I reverted to v1.

    EDIT
    It seem the issue is still there:
    https://forum.unity.com/threads/assetdatabase-v2-refresh-significantly-slower-than-v1.802635/
     
  8. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Ok great. Let me know if the basic search asset file paths is good enough for your production. The asset file paths search is multi-threaded and should be quite fast, but for sure, not as fast as using a search index. For a ~6000 assets project, it takes around 30-100 ms to search asset file paths as with an index it takes around 0-5 ms. That said, all searches are done asynchronously so it shouldn't stall the UI more than 25 ms at a time.
     
  9. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    The "ref:" search is not async right? I tried to run a search with that and it is blocking the UI since the search is quite slow(18 seconds).
    The slowness is probably my fault, have several scripts where I simply used onValidate method to run some editor script without writing an editor interface, and I see that the search is firing the onValidate methods.
    I need to clean these up, since these method slow down the build too.
     
  10. SlimeProphet

    SlimeProphet

    Joined:
    Sep 30, 2019
    Posts:
    50
    Quick search has made Unity so much more usable! This is my second go-round with Unity, and I've always found the interface crude and unintuitive. Quick search really modernizes it. Thanks for your work on this!
     
    jonathans42 likes this.
  11. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    On average a search however takes me 3 seconds on an intel 4770k and a crucial P1 ssd.
    By the way, I found a bug.
    When the editor lose focus, for example switching to another app, the search window disappear.
     
  12. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    3 seconds!! Ok we need to look into that. Can you connect to this slack server (https://unitydevs.slack.com/) and meet me on #quicksearch? We'll see what is going on.
     
  13. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yes that is the expected behavior unless you use the dockable mode:

    upload_2020-7-23_15-50-7.png

    When using that option the window will be dockable and you'll be able to resize it like you want. This way it won't close itself when unity loses focus.

    upload_2020-7-23_15-51-17.png
     
  14. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hi @jonathans42!

    I'm not sure if I'm using index files, how would I tell?
    I tried cutting down the search items but assets covers so much stuff, not sure if it would be too much clutter but it might be nice to be able to prioritise say scenes and scripts over materials or something?

    Oh also, when I choose the dockable window, it disappears if I select an item from the quicksearch. That doesn't sound right.

    Thanks!
     
  15. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    If you have some time, you can reach me on https://unitydevs.slack.com/ #quicksearch so I can try to help you out with this.
     
  16. oskarious

    oskarious

    Joined:
    May 26, 2011
    Posts:
    6
    Hi, I am running 2019.4.1f1 and quick search 2.0.2 (and preview.3 - 2.1.0, haven't tested other versions) crashes the editor semi-randomly, though more often than not, when dropping an asset from the search window into the scene view, both when in a scene proper and when editing a prefab. I uploaded a bug report as well with the title "Dropping an asset from quick search to scene view crashes the editor". Don't know if you need any more information or if that's enough to at least take a look at!
     
  17. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi, I know there is a know issue with drag and drop crashing the editor when the window initiating the drag operation gets closed. I'll check internally where the fix is at and get back to you. Maybe it needs to be backported to 19.4.

    Thanks,
     
  18. oskarious

    oskarious

    Joined:
    May 26, 2011
    Posts:
    6
    Got a reply to my bug report as well, it has been fixed in 2020.2.0a18 as per https://issuetracker.unity3d.com/is...ing-the-window-from-which-the-drag-originated
    It would be awesome if it was back ported, but good to know it already has been fixed.

    Thanks!
     
  19. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
  20. oskarious

    oskarious

    Joined:
    May 26, 2011
    Posts:
    6
    Awesome, thanks for the help!
     
  21. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    The only thing that I wish this tool would support...
     
  22. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    You can search by reference using ref:

    upload_2020-10-8_8-56-9.png

    Make sure you check the Dependencies option in the index settings:

    upload_2020-10-8_8-56-57.png
     
    Neonage likes this.
  23. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Is there any API access to that?

    Ie. could I write a thing that allowed me to right-click an asset, click an option, and get the result of searching for ref:asset as a list in my console?
     
  24. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yes you can use the
    SearchService
    API for that. Note that the API is async, but you can use
    SearchService.GetItems(..., SearchFlags.Synchronous)
    if you wanna block (but not recommended).
     
  25. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    You can play with the DependencyProvider.cs sample if you want.

    image.png
     

    Attached Files:

  26. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311
    Hey! Firstly, I've been really enjoying Quick Search, it's a massive workflow improvement, super handy!

    Today I decided to create a custom Search Provider, and I must say the documentation isn't great. The example shown for registering a search provider appears to use the in-built provider for menu items, and it doesn't compile, because 1) it uses internal methods 2) the fetchItems lambda doesn't return anything. It's also only mentioned on a different page that you're meant to return null if not using the async method. Furthermore, to a new user, it's not very clear from this example if the missing method GetMenuInfo(itemNames, shortcuts) is responsible for anything important. As a new user, I would have really appreciated some standalone example code, that I could bring into my project, have it compile, and modify from there.


    That aside, I've managed to get a provider working, but have hit a small issue. We're working on a card game, so I thought it'd be handy to have a way of quickly reviewing what a particular card does. This works, displaying the card's title, description and artwork as the Label / Description / Thumbnail.

    Unfortunately, the search item's description GUI doesn't handle multi-line text nicely; it overlaps with other results (unless highlighted, which appears to draw over other results). I came across the "descriptionFormat" enum on SearchItem, and tried setting that to Ellipses, but that doesn't appear to do anything (at least in my case). You can see this below.

    So my questions / comments are:
    1. Is this a known issue, am I doing something wrong / is there something I can do about it?

    2. Is there anything I can do about improving the search result order? Below, Strike is not the first result, when it preferably would be. I'm using very similar code to that shown on the documentation (SearchProvider.MatchSearchGroups), but have tried experimenting with the SearchItem score, with mixed results.

    3. It would be fantastic if there was an additional "previewDescription" field/property, that defaulted to the normal description, that could be overriden to specify a different description for the full preview on the right hand side. If this were the case, I could display a short / trimmed description for each search result (and could do my own ellipsis trimming), and display a more detailed description on the right (for instance, you can see here, I'd also like to display the card Type and cost above the description (e.g. [Talent: 4-0]). I think this would be really useful even beyond my use case, as I can imagine several things I could search for where I'd want to display a more detailed description in the full preview.



    And finally (sorry for the behemoth!), another thing that could improve a new user's experience, would be if we could get a base class SearchProvider that handled all the behaviour in the default way, and we just override whatever we need. Perhaps this exists and I didn't come across it, but if I could have inherited a provider that handles Asset / ScriptableObject queries in the default way (Enter/Click = Ping Object, Thumbnail = editor preview texture, Label = asset name etc), then I could have just overriden the label, thumbnail and description properties as needed (e.g. swap Thumbnail for a texture assigned to the ScriptableObject). Just a thought!

    For reference, I'm on 2019.2 using QS 1.5.4. Thanks!
     
    DoBrain and oxysofts like this.
  27. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    Great! I'll forward that to Open Project team as I think they are also unaware but plan to use ScriptableObjects a lot.
     
  28. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    Can we somehow open default window with searched text in 3.0?
    Doing for ex:

    Code (CSharp):
    1.  
    2. var context = SearchService.CreateContext( SearchService.Providers, "a");
    3. SearchService.ShowWindow( context );
    Opens search with empty "searchText"
     
    Last edited: Oct 8, 2020
  29. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    71
    Would it be possible to add shortcut bindings to quick search so that I could navigate the results with Emacs-style
    C-n
    /
    C-p
    instead of the up and down arrows? It would make things so much faster. Thanks!
     
  30. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    This looks like a bug. Let me double check that. Can you report an issue for it?
     
  31. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yes, can you report an issue so we can fast track it?

    Thanks,
     
  32. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    I will if I find some time. I've looked at source code and it seems like last saved value overwrites the one passed with SearchService.ShowWindow.
     
  33. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Not ideal, but as a workaround,
    ShowWindow
    returns the
    ISearchView
    , and the with the
    ISearchView
    you have
    ISearchView.SetSearchText
    than you can use.

    See https://docs.unity3d.com/Packages/c...String_Unity_QuickSearch_TextCursorPlacement_

    I'll fix the ShowWindow in the next release.

    Thanks for reporting.
     
  34. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    Kind of breaks after changing a scene:
    1. Search for something that's used in different scene (with ref)
    2. Open that Scene
    3. Project provider doesn't work anymore
     
  35. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    You mean using a scene index?
     
  36. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    I mean by typing "ref:something" in search box
     
  37. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    71
    Certainly! I'm not actually sure how to do that, is there a standard link?
     
  38. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Fastest way is through the Editor itself:

    upload_2020-10-10_19-36-53.png
     
  39. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    jonathans42 likes this.
  40. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    71
    jonathans42 likes this.
  41. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Thanks for the feedback:

    - Doc: I agree that we need to improve our documentation examples.
    - Description: currently limited to a single line. We are working on a Table View mode for QuickSearch that will allow you to chose any properties you want to display. By example if your card model are a scriptable object, you could map to any column any of the SerializedProperties of your card object.
    - the order of SearchItem is set using 2 criterias: result are first grouped by search provider. The order of each provider can be seen in the preferences of Search. Then we sort according to the item score.
    - Good suggestion for fetchDescription.
    - We understand your issue with having to redefine the various actions for your provider. In your case, you are mostly doing a specialization of the Asset provider (since your card appears to be asset). The TableView that I talked above would solve most of your issues: you would have to create a specific provider, and could just setup a TableConfiguration showcasing the properties you are intereted with. That said, have a way to extend the base Asset provider could be a good idea.

     
  42. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311
    Thanks very much for all the info, sounds great :)

    The TableView sounds very useful, but I doubt it'd work perfectly for me as whilst our cards are ScriptableObjects, very few of their SerializedProperties would be innately drawable (for instance, their description is just a localisation key, so unless I can supply a method / attribute that fetches the full string, it wouldn't display correctly).

    Really my number 1 request would be to separate the description properties for entries vs their full preview on the right, as this would A) let me fix my issue with multiline text myself B) very straightforward / I can fetch whatever strings I want C) offers a lot of flexibility without the potentially overwhelming amount of information that might be displayed in a TableView.
     
  43. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yes I will make sure you can easily know the description is fetched when rendered in the details view compared to the result view.
     
  44. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    I also have the same criticism as Tweedie regarding the API, it takes a LOT of work just to display some assets into a custom search provider. The issue is that the existing search provider are providing information that is too granular, since most people who will use this API will be more interested in supplying higher-level information like whole assets.

    Great idea with the TableView, QuickSearch is rapidly evolving into something more. If the table view with columns is able to work with arbitrary components and scene objects, it wouldn't take much more for Quick Search to also act as a generic 'database' tool for querying and browsing frequently needed information. Used in conjunction with lights in the scene, light probes, etc. artists would be elated.

    Aside from this, is it currently possible to access saved searchs in the input box as if they were search tokens? E.g. in our issue tracker, I can create a saved search named 'foo' with some query, and then use `#{foo}` as a placeholder for that query, then I can continue with more criteria or text. Currently I have to select the saved search manually to use it which greatly limits its usefulness.
     
  45. Dorodo

    Dorodo

    Joined:
    Mar 8, 2015
    Posts:
    44
    Does
    ref:
    work with other filters? I tried looking for the references of a file and tried to use
    t:prefab
    alongside in order to only look for the prefabs in dependencies, but it gave no results. Same with Labels. Using just
    ref:
    works fine.
     
  46. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,526
    When using the search I was thinking about a way to save a selection in the search results to a new saved search.
    How about if we could just select the items and drag them to the saved search panel on the left side?

     
  47. Kalimdor89

    Kalimdor89

    Joined:
    Aug 17, 2020
    Posts:
    1
    Hi,

    I am totally fresh in Unity and when I want to add this addon to Unity in HDRP fresh project i have such information:

    upload_2020-11-19_23-54-23.png

    What kind of error I am looking at :p
     
  48. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    This is a good idea. We have a way to save in a SearchQuery a subset of the items of a query (this is not used in the UX yet). But assuming we would support the subset of items, selecting various elements in the list and dragging those to the Save Searches panel could create a new SearchQuery.

     
    Lars-Steenhoff likes this.
  49. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    It seems that "file extension" searches do not return assets right now.

    Could you add that?
    201126-125850.gif

    (t:scene Thumbnails works but is much slower to type; also does Thumbnails t:scene)

    Essentially I think adding a "." at the end of anything should not return folders anymore; adding more than a ".", say ".u" should only return files with that extension.
     
    JesOb likes this.
  50. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    282
    Is there any way to set the location of the quick search window? I love the drag and drop feature, but right now the window completely covers the scene view.. which is where I want drag the object. (In this case, onto a table in the scene).

    Alternatively, when dragging / dropping, the quick search window could be faded / hidden.

    upload_2020-12-9_8-42-46.png
     
    mariandev and fherbst like this.