Help > Federator > Creating Connectors > Extending the Query Translator

Extending the Query Translator

This example creates a QueryTranslator that overrides the GetOperator method and ignores the right-hand side of a NOT operator. This means if a user searches for “CAT NOT DOG AND FISH”, the translator will create “CAT AND FISH” ignoring the NOT DOG.

class MyQueryTranslator : QueryTranslator
{
	public override string GetOperator(string oper, string left, string right)
	{
		if (oper != "NOT")
			return base.GetOperator(oper, left, right);
		else
			return left;
	}
}

To get your federator to use the new query translator, we must modify the MyFederatorConnectors constructor to look like:

public RSSFederator()
	: base(new MyQueryTranslator())
{
}

This ties our new QueryTranslator with our FederatorConnector class.