-
Notifications
You must be signed in to change notification settings - Fork 78
Design and internals
The scoped_search plugin consists of several parts:
- The query language parser;
- The SQL conditions builder;
- The syntax auto-completer;
- The part that bolts the functionality onto ActiveRecord.
- The GUI integration.
File: lib/scoped_search/query_language/parser.rb
This file parses the query string and returns the result as an array of search terms.
File: lib/scoped_search/query_builder.rb
Creates WHERE clause conditions for every field that must be searched, using the array of search terms. This part is a bit DBMS specific.
File: lib/scoped_search/auto_complete_builder.rb
Get a part of a query and build a list of possible completion options according to the search syntax
File: lib/scoped_search.rb
Adds the scoped_search
method to the the ActiveRecord::Base
class. Calling this method on a subclass will create the search_for
named scope and the complete_for
method.
Files in: app/assets
Adds the scoped search javascript and css of the auto-completer widget.