The extension points into SearchEF are within the EFTextSearchEngine class. You can tap into it’s methods and properties by inheriting, mocking or listening into events.
Create a new instance of the EFTextSearchEngine and set the event handlers.
1: var engine = new EFTextSearchEngine();
2:
3: //Assign the event handlers
4: engine.OnSplitCriteraInStack += new Action<Stack<string>>(engine_OnSplitCriteraInStack);
5: engine.OnProcessStackComplete += new Action<List<SearchOperand>>(engine_OnProcessStackComplete);
6: engine.OnResultFound += new Action<ISearchResult>(engine_OnResultFound);
Some example code using the event handlers assigned above.
1: void engine_OnSplitCriteraInStack(Stack<string> obj)
2: {
3: foreach (string stackItem in obj)
4: Console.WriteLine("Search Criteria Item: " + stackItem);
5: }
6:
7: void engine_OnProcessStackComplete(List<SearchOperand> obj)
8: {
9: obj.ForEach(s => Console.WriteLine("Operand: " + s.Operand + " Operator: " + s.OperatorType.ToString()));
10: }
11: void engine_OnResultFound(ISearchResult obj)
12: {
13: Console.WriteLine("Found: " + obj.ResultType.Name + " Content: " + obj.Content);
14: }
Setup a standard call passing in the engine.
1: var customers = this._entities.Search<Customer>(@"owner AND Ana Sales ""Aria Cruz""",
2: (Customer c) => c.Address != string.Empty,
3: (Type t) => t == typeof(string) || t == typeof(int),
4: engine //<-- Engine parameter here
5: );