Click or drag to resize

ConventionConfigurationGetIndexName Property

Gets or sets the method that returns the index names(s) for the given type. The default converts the type name to lower case and pluralizes it (by appending an 's').

Namespace:  SphinxConnector.FluentApi
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
public Func<Type, FulltextSessionContext, string> GetIndexName { get; set; }

Property Value

Type: FuncType, FulltextSessionContext, String
Remarks
Methods may return a comma separated list of index names. This is useful in case the data for a type is stored in several indexes, e.g. in main-delta setups or if stemmed documents reside in a seperate index. The default looks like this:
GetIndexName = (type, context) => type.Name.ToLowerInvariant() + "s";
Examples
An example for a main-delta setup could look like this:
GetIndexName = (type, context) => String.Format("{0}, {0}_delta", type.Name.ToLowerInvariant() + "s");
You can also return different index names depending on the context. Supppose you have two real-time indexes: one for the original documents and one for the stemmed documents, and you've setup a distributed index to let Sphinx search them in parallel. You'd then direct saves and deletes to both indexes, queries on the other hand would go to the distributed index:
GetIndexName = (type, context) =>
{
    if (context.OperationType == OperationType.Save || context.OperationType == OperationType.Delete)
    {
        return String.Format("{0}, {0}_stemmed", type.Name.ToLowerInvariant() + "s");
    }

    return String.Format("{0}_dist", type.Name.ToLowerInvariant() + "s");
};
See Also