Fluent API

In version 3 don't use the old class IndexItem, use the new class IndexingJob that should be added to the indexing queue (table avtSearchBoost_IndexingQueue) with indexingJob.Save().

In version 2.6.0 we added a new API to simplify indexing content since the existing indexing API contained many parameters. it was also too difficult to build it all at once. The new Fluent API creates an IndexItem object that allows you to pass around to other components, as well as fill with content and metadata.

The following code shows how data from custom rules are passed to the index using the new Fluent API.
IndexItem item = new IndexItem(); item = item .SetType("rule") .SetContainerId("rule-" + rule.RuleID) .SetContainerName(rule.RuleName) .SetInstanceIds(instances) .SetTitle(title) .SetContent(GetContent(rule, sr, results)) .SetModuleId(ParseModuleId(rule, sr, results, logger, item.Title)) .SetTabId(ParseTabId(rule, sr, results, logger, item.Title)) .SetPortalId(portalId) .SetAuthorId(ParseAuthorId(rule, sr, results)) .SetId(id)) .SetItemId(searchKey + "-" + item.Id) .SetDesc(ParseDesc(rule, sr, item.Content, item.Id)) .SetCategories(ParseCategories(rule, sr, results)) .SetDatePublished(ParsePublicationDate(rule, sr, results)) .SetGetParams(ParseGetParams(rule, sr, results)) .SetUrl(ParseUrl(rule, sr, results, item.GetParams)) .SetData(ParseData(rule, sr, results)) .SetBoost(rule.Boost) .AddRole("All Users");

API Specification

Note there are redundancies with the indexed fields. Some are there for legacy reasons, while others provide optimization. 


Sets the type of content. For custom indexers, use "plugin". The SetType("rule") function specified in the object sets the rule for the string.


Sets the subtype of content. For documents, this is "pdf", "docx" and so on. For custom indexers, use a keyword that uniquely identifies your indexer.


Sets an ID that uniquely defines the container and where data comes from.  For example, it could be a rule ID for the custom rules, a folder for documents, a domain for web pages and so on. For custom indexers, use what is relevant for you. The SetContainerId("rule-" + rule.RuleID) function specified in the object passes the rule string and sets a unique id for the rule.


This is the friendly representation of the container, such as the rule name, the folder name and so on. Again, use what makes sense to you. This function is only used for display purposes. The SetContainerName(rule.RuleName) function  specified in the object sets a rule name for the rule.


This represents the path of the container relative to paths of other containers. Folders for example, is the relative path from the portal root. It is used by Search Boost to determine if a container is a parent of another container.


This is same as above, the only difference is that it reflects the item. For example, it could be the path to a file that includes the file and extension. Search Boost uses this to determine unique items, therefore two items with the same path is considered identical.


Items are wired to Search Boost instances, so they appear when the search is initiated in these instances.


Same as above, but add one instance at a time.


The title is shown in search results as the header of each item, but depends on the results template.


The description appears on the results page just below the title. If this is not supplied, Search Boost will build it automatically from content. If the highlighter is enabled in Search Engine settings, then this description is ignored because the description is rebuilt from content to reflect the position of the matched words.


This is the text that will be searchable (along with title and description, if enabled in settings). If you have multiple content sources, append all of them to the same string but separate them with spaces.


This determines which portal this item belongs.


This determines which portal page this item belongs. Pass -1 if no relation exists.


This determines which module this item belongs. Pass -1 if no relation exists.


Pass the id of the user that generated the content with this method.


Pass the item ID as it exists in your space to be able to get back the item if needed later.


This uniquely identifies the item across all indexed items. So if the same item is indexed multiple times, this field needs to be different.


Assigns this item to a category. Categories are used especially for a faceted search.


Same as above, but assigns multiple categories at once.


This is the date when this content is published. When implementing a custom indexer, use this to design incremental indexing by looking only at content that was updated.


Pass a query parameter string here that will append the result URL. The string can look like "param1=value1&param2=value2"


Each result must point somewhere. If this field is empty, Search Boost will determine URL from ModuleId or TabId fields.


Sets arbitrary data that Search Boost will pass to the search results XSL template, so you can build smarter customized output.


Same as above, but add one entry at a time.


SetBoost determines how important this item is, that is how high the content ranks compared to other results. Use values in range 0-1 to lower the boost, and values higher than 1 to increase it. 1 means there is no influence on the boost.


If content is specific to one language, pass that language to have this result come up only when the current locale matches the locale provided. If this field is not specified then Search Boost will assume neutral locale and the result will come up for all languages.


Set a list of roles that see this result. Any roles that already exist in the list is overwritten. If this is empty the content will only be visible to Administrators.


Same as above, but add one role at a time.


Append a list of roles at a time.