Skip to content

A javascript library for evaluating boolean search terms provider for Angular.js.

License

Notifications You must be signed in to change notification settings

artemgrygor/boolean-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#boolean-search

Build Status

A javascript library for evaluating boolean search terms provider for Angular.js applications. ngBooleanSearch is small (~7Kb), has minimalistic API and has only Angular.js as a dependency.

You can use a following string to filter objects, where title is a property of object and search me can be a value of any property of this object.

search me title: awesome and cool or great

Install

You can download all necessary ngBooleanSearch files manually or install it with bower:

bower install ngBooleanSearch

Usage

You need only to include ngBooleanSearch.js to your project and then you can start using ngBooleanSearch provider in your directives, controllers and services.

Register ngBooleanSearch module at your application

var app = angular.module('exampleApp', ['ngBooleanSearch']);

app.controller('MainCtrl', function ($scope, ngBooleanSearch) {
});

and then at your filter function

$scope.searchTextFn = function(actual, search){

	return ngBooleanSearch.filterBookmark(item, search);
};

API

ngBooleanSearch service provides easy to use and minimalistic API, but in the same time it's powerful enough. Here is the list of accessible methods that you can use:

.generateExpressionTree(searchText)

Method allows to generate expression tree by a search string and allows not to create a new instance on each call. It accepts searchText string as the only argument.

.filterBookmark(bookmark, searchText)

Method allows to filter object by search text with boolean expression. It accepts bookmark object as the first argument and searchText string as the second one.

How to build

You need this section only if you are interesting in updating current docset or build your own docset generator based on this.

  1. Clone this repository.
  2. Install node.js.
  3. Install bower.io npm install -g bower.
  4. Download all npm dependencies with npm install (invoking from root project folder).
  5. Download all bower dependencies with bower install (invoking from root project folder).
  6. Launch gulp test command to run all test and check that everything is correct.

License

Apache License, Version 2.0


About

A javascript library for evaluating boolean search terms provider for Angular.js.

Resources

License

Stars

Watchers

Forks

Packages

No packages published