Class ObjectIndexer
Specialized SearchIndexer used to index Unity Assets. See UnityEditor.Search.AssetIndexer for a specialized SearchIndexer used to index simple assets and see UnityEditor.Search.SceneIndexer for an indexer used to index scene and prefabs.
Inherited Members
Namespace: UnityEditor.Search
Syntax
public abstract class ObjectIndexer : SearchIndexer
Methods
GetEntryComponents(String, Int32)
Splits a string into multiple words that will be indexed. It works with paths and UpperCamelCase strings.
Declaration
public virtual IEnumerable<string> GetEntryComponents(string entry, int documentIndex)
Parameters
Type | Name | Description |
---|---|---|
String | entry | The string to be split. |
Int32 | documentIndex | The document index that will index that entry. |
Returns
Type | Description |
---|---|
IEnumerable<String> | The entry components. |
IndexDocument(String, Boolean)
Function to override in a concrete SearchIndexer to index the content of a document.
Declaration
public abstract override void IndexDocument(string id, bool checkIfDocumentExists)
Parameters
Type | Name | Description |
---|---|---|
String | id | Path of the document to index. |
Boolean | checkIfDocumentExists | Check if the document actually exists. |
Overrides
IndexNumber(Int32, String, Double)
Add a key-number value pair to the index. The key won't be added with variations. See AddNumber(String, Double, Int32, Int32).
Declaration
public void IndexNumber(int documentIndex, string name, double number)
Parameters
Type | Name | Description |
---|---|---|
Int32 | documentIndex | Document where the indexed value was found. |
String | name | Key used to retrieve the value. |
Double | number | Number value to store in the index. |
IndexObject(Int32, Object, Boolean)
Index all the properties of an object.
Declaration
protected void IndexObject(int documentIndex, Object obj, bool dependencies = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | documentIndex | Document where the indexed object was found. |
Object | obj | Object to index. |
Boolean | dependencies | Index dependencies. |
IndexProperty(Int32, String, String, Boolean, Boolean)
Add 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. See AddProperty(String, String, Int32, Boolean, Boolean).
Declaration
public void IndexProperty(int documentIndex, string name, string value, bool saveKeyword, bool exact = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | documentIndex | Document where the indexed word was found. |
String | name | Key used to retrieve the value. See AddProperty(String, String, Int32, Boolean, Boolean) |
String | value | Value to add to the index. |
Boolean | saveKeyword | Define if we store this key in the keyword registry of the index. See UnityEditor.Search.SearchIndexer.GetKeywords. |
Boolean | exact | If exact is true, only the exact match of the value will be stored in the index (not the variations). |
IndexPropertyComponents(Int32, String, String)
Split a value into multiple components.
Declaration
public void IndexPropertyComponents(int documentIndex, string name, string value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | documentIndex | Document where the indexed word was found. |
String | name | Key used to retrieve the value. See AddProperty(String, String, Int32, Boolean, Boolean) |
String | value | Value to add to the index. |
IndexWord(Int32, String, Boolean, Int32)
Add a new word coming from a specific document to the index. The word will be added with multiple variations allowing partial search. See AddWord(String, Int32, Int32).
Declaration
public void IndexWord(int documentIndex, string word, bool exact = false, int scoreModifier = 0)
Parameters
Type | Name | Description |
---|---|---|
Int32 | documentIndex | Document where the indexed word was found. |
String | word | Word to add to the index. |
Boolean | exact | If true, we will store also an exact match entry for this word. |
Int32 | scoreModifier | Modified to apply to the base score for a specific word. |
IndexWord(Int32, String, Int32, Boolean, Int32)
Add a new word coming from a specific document to the index. The word will be added with multiple variations allowing partial search. See AddWord(String, Int32, Int32).
Declaration
public void IndexWord(int documentIndex, string word, int maxVariations, bool exact, int scoreModifier = 0)
Parameters
Type | Name | Description |
---|---|---|
Int32 | documentIndex | Document where the indexed word was found. |
String | word | Word to add to the index. |
Int32 | maxVariations | Maximum number of variations to compute. Cannot be higher than the length of the word. |
Boolean | exact | If true, we will store also an exact match entry for this word. |
Int32 | scoreModifier | Modified to apply to the base score for a specific word. |
IndexWordComponents(Int32, String)
Split a word into multiple components.
Declaration
public void IndexWordComponents(int documentIndex, string word)
Parameters
Type | Name | Description |
---|---|---|
Int32 | documentIndex | Document where the indexed word was found. |
String | word | Word to add to the index. |
Search(String, SearchContext, SearchProvider, Int32, Int32)
Run a search query in the index.
Declaration
public override IEnumerable<SearchResult> Search(string searchQuery, SearchContext context, SearchProvider provider, int maxScore = 2147483647, int patternMatchLimit = 2999)
Parameters
Type | Name | Description |
---|---|---|
String | searchQuery | Search query to look out for. If if matches any of the indexed variations a result will be returned. |
SearchContext | context | The search context on which the query is applied. |
SearchProvider | provider | The provider that initiated the search. |
Int32 | maxScore | Maximum score of any matched Search Result. See score. |
Int32 | patternMatchLimit | Maximum number of matched Search Result that can be returned. See SearchResult. |
Returns
Type | Description |
---|---|
IEnumerable<SearchResult> | Returns a collection of Search Result matching the query. |
Overrides
SkipEntry(String, Boolean)
Called when the index is built to see if a specified document needs to be indexed. See skipEntryHandler
Declaration
public override bool SkipEntry(string path, bool checkRoots = false)
Parameters
Type | Name | Description |
---|---|---|
String | path | Path of a document |
Boolean | checkRoots |
Returns
Type | Description |
---|---|
Boolean | Returns true if the document doesn't need to be indexed. |