IndexProperty
Adds a property value to the index. A property is specified with a key and a string value. The value will be stored with multiple variations.
Read time 2 minutesLast updated 13 days ago
Definition
- Type: Method
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
IndexProperty(int, string, string, bool, bool)
Adds a property value to the index. A property is specified with a key and a string value. The value will be stored with multiple variations.
public void IndexProperty(int documentIndex, string name, string value, bool saveKeyword, bool exact = false)
Parameters
Document where the indexed word was found.
Key used to retrieve the value.
Value to add to the index.
Define if we store this key in the keyword registry of the index.
If exact is true, only the exact match of the value will be stored in the index (not the variations).
Remarks
The following example indexes a new boolean property named that will be used to search textures that match or .
testismobilefriendlytestismobilefriendly=truetestismobilefriendly=false[CustomObjectIndexer(typeof(Texture2D))]static void IndexMobileFriendlyTexture(CustomObjectIndexerTarget target, ObjectIndexer indexer){ var texture = target.target as Texture2D; if (texture == null) return; bool isMobileFriendly = texture.width < 64 && texture.height < 64; indexer.IndexProperty(target.documentIndex, "testismobilefriendly", isMobileFriendly.ToString(), true);}[CustomObjectIndexer(typeof(Texture2D))]static void CrashingIndexer(CustomObjectIndexerTarget target, ObjectIndexer indexer){ if (enableCrashingIndexer) throw new System.Exception("Crash");}
See SearchIndexer.AddProperty for more information and examples about indexing properties.
IndexProperty<T, U>(int, string, string, bool, bool)
Adds a property value to the index. A property is specified with a key and a string value. The value will be stored with multiple variations.
public void IndexProperty<TProperty, TPropertyOwner>(int documentIndex, string name, string value, bool saveKeyword, bool exact)
Parameters
Document where the indexed word was found.
Key used to retrieve the value.
Value to add to the index.
Define if we store this key in the keyword registry of the index.
If exact is true, only the exact match of the value will be stored in the index (not the variations).
Remarks
The following example indexes a new boolean property named that will be used to search textures that match or .
testismobilefriendlytestismobilefriendly=truetestismobilefriendly=false[CustomObjectIndexer(typeof(Texture2D))]static void IndexMobileFriendlyTexture(CustomObjectIndexerTarget target, ObjectIndexer indexer){ var texture = target.target as Texture2D; if (texture == null) return; bool isMobileFriendly = texture.width < 64 && texture.height < 64; indexer.IndexProperty(target.documentIndex, "testismobilefriendly", isMobileFriendly.ToString(), true);}[CustomObjectIndexer(typeof(Texture2D))]static void CrashingIndexer(CustomObjectIndexerTarget target, ObjectIndexer indexer){ if (enableCrashingIndexer) throw new System.Exception("Crash");}
See SearchIndexer.AddProperty for more information and examples about indexing properties.