Welcome to Fidely Project Web Site

What's Fidely

Fidely is a framework to implement a search query compiler that parses a search query string and builds up an expression tree (Expression<Func<T, bool>>) to filter a collection object. Fidely allows you to customize processes of parsing a query string and building up an expression tree, so you can create various search query compilers.
The goal of this project is to make it easy to implement collection filtering features into your application.

Introduction

Fidely provides the feature to generate a search query compiler that compiles a search query (e.g. "X1 < 1024 OR (X2 : Foo AND X3 >= 0)") into an expression tree (Expression<Func<T, bool>>). It can be used to filter a collection object.

The following is the simplest code to use Fidely search query compiler.

public IEnumerable<XXXEntity> Search(IEnumerable<XXXEntity> entities)
{
    SearchQueryCompiler<XXXEntity> compiler = 
        SearchQueryCompilerBuilder.Instance.BuildUpDefaultCompilerForObject<XXXEntity>();

    string query = "Name:Laptop AND (10000 <= UnitPrice * 1.05 <= 50000)";
    Expression<Func<XXXEntity, bool>> filter = compiler.Compile(query);

    return entities.AsQueryable().Where(filter);

    // You can also write as follows:
    // Func<XXXEntity, bool> func= filter.Compile();
    // return entities.Where(func);
}

By compiler.Compile(query), an expression tree that is equivalent to (XXXEntity o) => o.Name.Contains("Laptop") && (10000 <= o.UnitPrice * 1.05 && o.UnitPrice * 1.05 <= 50000) will be generated.

Features

  • Easy To Use
Fidely provides the default search query compiler that consists of built-in operand evaluators and operators. It supports basic calculating operators (+, -, *, /), comparative operators (=, !=, <, <=, >, >=), prefix search, suffix search and partial matching. You can begin using the powerful search query compiler without any configuration.
  • Powerful Parser
Fidely parser supports parentheses ('(' and ')'), quotation marks (' and "), logical operators (AND and OR) and any comparative and calculating operators. You don't have to make an effort to parse a search query.
  • Flexible Customization
Fidely allows you to customize processes of parsing a query string and building up an expression tree. For example, you can assign any symbol as an operator. The default search query compiler defines =, !=, <, <=, > and >= as comparative operators, but you can change operator symbols to eq, ne, lt, le, gt and ge.
Fidely has also many customizable points. For more detail, refer to this page.
  • UI Integration
Fidely also provides UI components to make it easy to implement a search box into your application.
ui_integration.png

I welcome all your feedback. If you have any problems, feature requests and so on, please send me feedback via Twitter or CodePlex issue tracker.

Last edited Jun 11, 2011 at 11:05 PM by sasaminn, version 19