static SearchQuery <tRow> fullTextQuery <tRow>(iTypeSerializer ser, ParameterExpression eRecord, ParameterExpression eArgument, Expression eLeft, Expression eRight, int argsCount) where tRow : new() { HasParam hp = new HasParam(eRecord); bool leftParam = hp.hasParameter(eLeft); if (!leftParam) { throw new NotSupportedException("Full-text queries must have column as the first argument"); } MemberInfo column = parseColumn(eRecord, eLeft); bool rightParam = hp.hasParameter(eRight); if (rightParam) { throw new NotSupportedException("Full-text queries can't include column in the second argument"); } Func <object, object> arg = parseConstant(eArgument, eRight); IndexForColumn[] inds = ser.indicesFromColumn(column); IndexForColumn ind = inds.FirstOrDefault(i => i.columnIndex == 0 && i.attrib is Attributes.EseTupleIndexAttribute); if (null == ind) { throw new NotSupportedException("Failed to parse full-text search query: no suitable index found"); } string indName = ind.indexName; Action <Recordset <tRow>, object> act = (rs, a) => rs.filterFindSubstring(indName, arg(a)); return(new SearchQuery <tRow>(act, argsCount, true)); }
/// <summary>Select the index by name</summary> public void selectIndex(string name) { selectedIndex = indices.FirstOrDefault(ii => ii.indexName == name); if (null == selectedIndex) { throw new ArgumentException("Index {0} not found".formatWith(name)); } }