Finish
Finalizes the current index, sorting and compiling of all the indexes.
Read time 8 minutesLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
Finish()
Finalizes the current index, sorting and compiling of all the indexes.
public void Finish()
Examples
using System.Linq;using UnityEditor;using UnityEditor.Search;using UnityEngine;/// <summary>/// SearchIndexer.Finish is always a threaded operation, meaning that all indexes/// will be computed in a thread and Search will callback when the index is ready/// to be used./// </summary>static class Example_SearchIndexer_Finish{ [MenuItem("Examples/SearchIndexer/Finish")] public static void Run() { // Create an indexer and wait for indexing to complete in the current thread. var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject()); si.Start(); si.AddProperty("wait", "yes", si.AddDocument("Wait")); si.Finish(); while (!si.IsReady()) ; Debug.Assert(si.IsReady()); // Reset the indexer and receive a callback when the indexing is completed. si.Start(clear: true); si.AddProperty("wait", "callback", si.AddDocument("Callback")); si.Finish(() => Debug.Log("Indexing is ready.")); while (!si.IsReady()) ; // Reset the indexer and receive a callback when the indexing is completed. // With that override you can also indicate if you want any documents to be deleted si.Start(clear: false); si.AddProperty("wait", "callback", si.AddDocument("CallbackBytes")); si.AddProperty("wait", "callback", si.AddDocument("DeleteMe")); si.Finish(() => { Debug.Log($"Indexing is ready."); // Dispose of the SearchIndexer when you are done with it. si.Dispose(); }, new string[] { "Callback", "DeleteMe" }); }}
Finish(Action)
Finalizes the current index, sorting and compiling of all the indexes.
public void Finish(Action threadCompletedCallback)
Parameters
Callback invoked when the index is ready to be used.
Examples
using System.Linq;using UnityEditor;using UnityEditor.Search;using UnityEngine;/// <summary>/// SearchIndexer.Finish is always a threaded operation, meaning that all indexes/// will be computed in a thread and Search will callback when the index is ready/// to be used./// </summary>static class Example_SearchIndexer_Finish{ [MenuItem("Examples/SearchIndexer/Finish")] public static void Run() { // Create an indexer and wait for indexing to complete in the current thread. var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject()); si.Start(); si.AddProperty("wait", "yes", si.AddDocument("Wait")); si.Finish(); while (!si.IsReady()) ; Debug.Assert(si.IsReady()); // Reset the indexer and receive a callback when the indexing is completed. si.Start(clear: true); si.AddProperty("wait", "callback", si.AddDocument("Callback")); si.Finish(() => Debug.Log("Indexing is ready.")); while (!si.IsReady()) ; // Reset the indexer and receive a callback when the indexing is completed. // With that override you can also indicate if you want any documents to be deleted si.Start(clear: false); si.AddProperty("wait", "callback", si.AddDocument("CallbackBytes")); si.AddProperty("wait", "callback", si.AddDocument("DeleteMe")); si.Finish(() => { Debug.Log($"Indexing is ready."); // Dispose of the SearchIndexer when you are done with it. si.Dispose(); }, new string[] { "Callback", "DeleteMe" }); }}
Finish(Action, string[])
Finalizes the current index, sorting and compiling of all the indexes.
public void Finish(Action threadCompletedCallback, string[] removedDocuments)
Parameters
Examples
using System.Linq;using UnityEditor;using UnityEditor.Search;using UnityEngine;/// <summary>/// SearchIndexer.Finish is always a threaded operation, meaning that all indexes/// will be computed in a thread and Search will callback when the index is ready/// to be used./// </summary>static class Example_SearchIndexer_Finish{ [MenuItem("Examples/SearchIndexer/Finish")] public static void Run() { // Create an indexer and wait for indexing to complete in the current thread. var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject()); si.Start(); si.AddProperty("wait", "yes", si.AddDocument("Wait")); si.Finish(); while (!si.IsReady()) ; Debug.Assert(si.IsReady()); // Reset the indexer and receive a callback when the indexing is completed. si.Start(clear: true); si.AddProperty("wait", "callback", si.AddDocument("Callback")); si.Finish(() => Debug.Log("Indexing is ready.")); while (!si.IsReady()) ; // Reset the indexer and receive a callback when the indexing is completed. // With that override you can also indicate if you want any documents to be deleted si.Start(clear: false); si.AddProperty("wait", "callback", si.AddDocument("CallbackBytes")); si.AddProperty("wait", "callback", si.AddDocument("DeleteMe")); si.Finish(() => { Debug.Log($"Indexing is ready."); // Dispose of the SearchIndexer when you are done with it. si.Dispose(); }, new string[] { "Callback", "DeleteMe" }); }}
Finish(Action<byte[]>, string[])
Finalizes the current index, sorting and compiling of all the indexes.
public void Finish(Action<byte[]> threadCompletedCallback, string[] removedDocuments)
Parameters
Callback invoked when the index is ready to be used.
Documents to be removed from current index (if any).
Examples
using System.Linq;using UnityEditor;using UnityEditor.Search;using UnityEngine;/// <summary>/// SearchIndexer.Finish is always a threaded operation, meaning that all indexes/// will be computed in a thread and Search will callback when the index is ready/// to be used./// </summary>static class Example_SearchIndexer_Finish{ [MenuItem("Examples/SearchIndexer/Finish")] public static void Run() { // Create an indexer and wait for indexing to complete in the current thread. var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject()); si.Start(); si.AddProperty("wait", "yes", si.AddDocument("Wait")); si.Finish(); while (!si.IsReady()) ; Debug.Assert(si.IsReady()); // Reset the indexer and receive a callback when the indexing is completed. si.Start(clear: true); si.AddProperty("wait", "callback", si.AddDocument("Callback")); si.Finish(() => Debug.Log("Indexing is ready.")); while (!si.IsReady()) ; // Reset the indexer and receive a callback when the indexing is completed. // With that override you can also indicate if you want any documents to be deleted si.Start(clear: false); si.AddProperty("wait", "callback", si.AddDocument("CallbackBytes")); si.AddProperty("wait", "callback", si.AddDocument("DeleteMe")); si.Finish(() => { Debug.Log($"Indexing is ready."); // Dispose of the SearchIndexer when you are done with it. si.Dispose(); }, new string[] { "Callback", "DeleteMe" }); }}
Finish(Action<byte[]>, string[], bool)
Finalizes the current index, sorting and compiling of all the indexes.
public void Finish(Action<byte[]> threadCompletedCallback, string[] removedDocuments, bool saveBytes)
Parameters
Callback invoked when the index is ready to be used.
Documents to be removed from current index (if any).
Indicates if the system should return the binary stream of the index as a byte array.
Examples
using System.Linq;using UnityEditor;using UnityEditor.Search;using UnityEngine;/// <summary>/// SearchIndexer.Finish is always a threaded operation, meaning that all indexes/// will be computed in a thread and Search will callback when the index is ready/// to be used./// </summary>static class Example_SearchIndexer_Finish{ [MenuItem("Examples/SearchIndexer/Finish")] public static void Run() { // Create an indexer and wait for indexing to complete in the current thread. var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject()); si.Start(); si.AddProperty("wait", "yes", si.AddDocument("Wait")); si.Finish(); while (!si.IsReady()) ; Debug.Assert(si.IsReady()); // Reset the indexer and receive a callback when the indexing is completed. si.Start(clear: true); si.AddProperty("wait", "callback", si.AddDocument("Callback")); si.Finish(() => Debug.Log("Indexing is ready.")); while (!si.IsReady()) ; // Reset the indexer and receive a callback when the indexing is completed. // With that override you can also indicate if you want any documents to be deleted si.Start(clear: false); si.AddProperty("wait", "callback", si.AddDocument("CallbackBytes")); si.AddProperty("wait", "callback", si.AddDocument("DeleteMe")); si.Finish(() => { Debug.Log($"Indexing is ready."); // Dispose of the SearchIndexer when you are done with it. si.Dispose(); }, new string[] { "Callback", "DeleteMe" }); }}
Finish(string[])
Finalizes the current index, sorting and compiling of all the indexes.
public void Finish(string[] removedDocuments)
Parameters
Documents to be removed from current index (if any).
Examples
using System.Linq;using UnityEditor;using UnityEditor.Search;using UnityEngine;/// <summary>/// SearchIndexer.Finish is always a threaded operation, meaning that all indexes/// will be computed in a thread and Search will callback when the index is ready/// to be used./// </summary>static class Example_SearchIndexer_Finish{ [MenuItem("Examples/SearchIndexer/Finish")] public static void Run() { // Create an indexer and wait for indexing to complete in the current thread. var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject()); si.Start(); si.AddProperty("wait", "yes", si.AddDocument("Wait")); si.Finish(); while (!si.IsReady()) ; Debug.Assert(si.IsReady()); // Reset the indexer and receive a callback when the indexing is completed. si.Start(clear: true); si.AddProperty("wait", "callback", si.AddDocument("Callback")); si.Finish(() => Debug.Log("Indexing is ready.")); while (!si.IsReady()) ; // Reset the indexer and receive a callback when the indexing is completed. // With that override you can also indicate if you want any documents to be deleted si.Start(clear: false); si.AddProperty("wait", "callback", si.AddDocument("CallbackBytes")); si.AddProperty("wait", "callback", si.AddDocument("DeleteMe")); si.Finish(() => { Debug.Log($"Indexing is ready."); // Dispose of the SearchIndexer when you are done with it. si.Dispose(); }, new string[] { "Callback", "DeleteMe" }); }}