Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mpneuried committed Sep 3, 2020
1 parent dea109f commit 678f4bf
Showing 1 changed file with 55 additions and 50 deletions.
105 changes: 55 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
backlunr
===========
# backlunr

is a solution to bring [Backbone Collections](http://documentcloud.github.com/backbone/#Collection) together with the browser fulltext search engine [Lunr.js](http://lunrjs.com/).

Expand All @@ -8,8 +7,9 @@ is a solution to bring [Backbone Collections](http://documentcloud.github.com/ba
## Install

To use **backlunr** you first have to load the dependencies:
- [Underscore](http://documentcloud.github.com/underscore)
- [Backbone](http://documentcloud.github.com/backbone)

- [Underscore](http://documentcloud.github.com/underscore)
- [Backbone](http://documentcloud.github.com/backbone)
- [Lunr.js](http://lunrjs.com/)

Then add the `backlunr.js` script to your page.
Expand All @@ -29,7 +29,7 @@ class User extends Backbone.Model

class Users extends Backbone.Collection.Lunr
model: User
lunroptions:
lunroptions:
fields: [
{ name: "firstname", boost: 10 }
{ name: "lastname", boost: 5 }
Expand All @@ -40,10 +40,10 @@ class Users extends Backbone.Collection.Lunr

#### lunroptions

* `fields` ( Array | Function ): An array of field definitions or a method called on init/reset which has to return the field definitions array
* `fields[ n ]` ( Object ): The field definition
* `fields[ n ].name` ( String - required ): The field name within your model attribute
* `fields[ n ].boost` ( Number - optional: default=1 ): A boost factor for results in this field.
- `fields` ( Array | Function ): An array of field definitions or a method called on init/reset which has to return the field definitions array
- `fields[ n ]` ( Object ): The field definition
- `fields[ n ].name` ( String - required ): The field name within your model attribute
- `fields[ n ].boost` ( Number - optional: default=1 ): A boost factor for results in this field.

**Attension:** Currently Lunr.js does not support an indexing of numeric values. To use numeric values **backlunr** converts all fields to strings.

Expand All @@ -57,7 +57,7 @@ To search within your collection you just have to call `.search( "[ term ]" )`.
# add some users
usersCollection = new Users [
firstname: "Fritz", lastname: "Maier", "email": "[email protected]", "address": "Teststreet 123"
,
,
firstname: "Hans", lastname: "Schubert", "email": "[email protected]", "address": "Checkway 987"
]

Expand All @@ -78,19 +78,19 @@ result.toJSON()

**arguments:**

* `term` ( String - required ): the search term
* `raw` ( Boolean - optional: default=false ): Return the raw lunr result including the `score` and models `cid` as `ref`
- `term` ( String - required ): the search term
- `raw` ( Boolean - optional: default=false ): Return the raw lunr result including the `score` and models `cid` as `ref`

**retuns ( Array ):**

An array of matching models.
If you define `raw=true` you will receive an array with object like `{ score: 0.789, ref: "c123" }`

* `toJSON()` If `raw=false` you can use the special `toJSON` method to transform the aray of models to an array of model attributes.
- `toJSON()` If `raw=false` you can use the special `toJSON` method to transform the aray of models to an array of model attributes.

## Ideas

* Create a solution to search in multiple collections by hooking them to a global search module. If a search has been done the result will return all matching models in al hooked collection including the type ( Collection name )
- Create a solution to search in multiple collections by hooking them to a global search module. If a search has been done the result will return all matching models in al hooked collection including the type ( Collection name )

## Work in progress

Expand All @@ -113,66 +113,71 @@ $ gulp

## Changelog

#### `0.2.5`

- Fixed handling of tags/arrays with spaces
- updated to current gulp version

#### `0.2.4`

* Readme typo fix [#2](https://github.com/mpneuried/backlunr/pull/2). Thanks to [Cody Nguyen](https://github.com/codynguyen)
* restructured code
* Updated test to Lunr.js `v0.6.0`, jquery `v2.1.4`, backbone `v1.2.3`, mocha `v2.3.4` and expect `v0.3.1`. **Backlunr test already working fine*
- Readme typo fix [#2](https://github.com/mpneuried/backlunr/pull/2). Thanks to [Cody Nguyen](https://github.com/codynguyen)
- restructured code
- Updated test to Lunr.js `v0.6.0`, jquery `v2.1.4`, backbone `v1.2.3`, mocha `v2.3.4` and expect `v0.3.1`. \*_Backlunr test already working fine_

#### `0.2.3`

* Fixed Issue #1 to init the collection on search if nor reset has been fired
* Added gulp compile
* Updated test to Lunr.js `v0.5.8`, jquery `v2.1.3`, mocha `v1.21.5` and expect `v0.3.1`. **Backlunr test already working fine*
- Fixed Issue #1 to init the collection on search if nor reset has been fired
- Added gulp compile
- Updated test to Lunr.js `v0.5.8`, jquery `v2.1.3`, mocha `v1.21.5` and expect `v0.3.1`. \*_Backlunr test already working fine_

#### `0.2.2`

* Updated test to Lunr.js `v0.5.3`, jquery `v2.1.1`, mocha `v1.19.0` and expect `v0.3.1`. **Backlunr test already working fine**
- Updated test to Lunr.js `v0.5.3`, jquery `v2.1.1`, mocha `v1.19.0` and expect `v0.3.1`. **Backlunr test already working fine**

#### `0.2.1`

* Updated test to Lunr.js `v0.4.0`, jquery `v2.0.3`, mocha `v1.12.0` and expect `v0.2.0`. **Backlunr test already working fine** but 15% faster.
* Compiled scripts with new coffee version `v1.6.3`
- Updated test to Lunr.js `v0.4.0`, jquery `v2.0.3`, mocha `v1.12.0` and expect `v0.2.0`. **Backlunr test already working fine** but 15% faster.
- Compiled scripts with new coffee version `v1.6.3`

#### `0.2.0`

* Added minified version
* Added support for numeric values by converting every field-value to a string
- Added minified version
- Added support for numeric values by converting every field-value to a string

#### `0.1.0`

* Initial version
- Initial version

## Todo

- restructure to use it standalone or with browserify, AMD, ...

## Other projects

|Name|Description|
|:--|:--|
|[**node-cache**](https://github.com/tcs-de/nodecache)|Simple and fast NodeJS internal caching. Node internal in memory cache like memcached.|
|[**rsmq**](https://github.com/smrchy/rsmq)|A really simple message queue based on redis|
|[**redis-heartbeat**](https://github.com/mpneuried/redis-heartbeat)|Pulse a heartbeat to redis. This can be used to detach or attach servers to nginx or similar problems.|
|[**systemhealth**](https://github.com/mpneuried/systemhealth)|Node module to run simple custom checks for your machine or it's connections. It will use [redis-heartbeat](https://github.com/mpneuried/redis-heartbeat) to send the current state to redis.|
|[**rsmq-cli**](https://github.com/mpneuried/rsmq-cli)|a terminal client for rsmq|
|[**rest-rsmq**](https://github.com/smrchy/rest-rsmq)|REST interface for.|
|[**nsq-logger**](https://github.com/mpneuried/nsq-logger)|Nsq service to read messages from all topics listed within a list of nsqlookupd services.|
|[**nsq-topics**](https://github.com/mpneuried/nsq-topics)|Nsq helper to poll a nsqlookupd service for all it's topics and mirror it locally.|
|[**nsq-nodes**](https://github.com/mpneuried/nsq-nodes)|Nsq helper to poll a nsqlookupd service for all it's nodes and mirror it locally.|
|[**nsq-watch**](https://github.com/mpneuried/nsq-watch)|Watch one or many topics for unprocessed messages.|
|[**redis-sessions**](https://github.com/smrchy/redis-sessions)|An advanced session store for NodeJS and Redis|
|[**connect-redis-sessions**](https://github.com/mpneuried/connect-redis-sessions)|A connect or express middleware to simply use the [redis sessions](https://github.com/smrchy/redis-sessions). With [redis sessions](https://github.com/smrchy/redis-sessions) you can handle multiple sessions per user_id.|
|[**redis-notifications**](https://github.com/mpneuried/redis-notifications)|A redis based notification engine. It implements the rsmq-worker to safely create notifications and recurring reports.|
|[**hyperrequest**](https://github.com/mpneuried/hyperrequest)|A wrapper around [hyperquest](https://github.com/substack/hyperquest) to handle the results|
|[**task-queue-worker**](https://github.com/smrchy/task-queue-worker)|A powerful tool for background processing of tasks that are run by making standard http requests
|[**soyer**](https://github.com/mpneuried/soyer)|Soyer is small lib for server side use of Google Closure Templates with node.js.|
|[**grunt-soy-compile**](https://github.com/mpneuried/grunt-soy-compile)|Compile Goggle Closure Templates ( SOY ) templates including the handling of XLIFF language files.|
|[**backlunr**](https://github.com/mpneuried/backlunr)|A solution to bring Backbone Collections together with the browser fulltext search engine Lunr.js|
|[**domel**](https://github.com/mpneuried/domel)|A simple dom helper if you want to get rid of jQuery|
|[**obj-schema**](https://github.com/mpneuried/obj-schema)|Simple module to validate an object by a predefined schema|

## License
| Name | Description |
| :-------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**node-cache**](https://github.com/tcs-de/nodecache) | Simple and fast NodeJS internal caching. Node internal in memory cache like memcached. |
| [**rsmq**](https://github.com/smrchy/rsmq) | A really simple message queue based on redis |
| [**redis-heartbeat**](https://github.com/mpneuried/redis-heartbeat) | Pulse a heartbeat to redis. This can be used to detach or attach servers to nginx or similar problems. |
| [**systemhealth**](https://github.com/mpneuried/systemhealth) | Node module to run simple custom checks for your machine or it's connections. It will use [redis-heartbeat](https://github.com/mpneuried/redis-heartbeat) to send the current state to redis. |
| [**rsmq-cli**](https://github.com/mpneuried/rsmq-cli) | a terminal client for rsmq |
| [**rest-rsmq**](https://github.com/smrchy/rest-rsmq) | REST interface for. |
| [**nsq-logger**](https://github.com/mpneuried/nsq-logger) | Nsq service to read messages from all topics listed within a list of nsqlookupd services. |
| [**nsq-topics**](https://github.com/mpneuried/nsq-topics) | Nsq helper to poll a nsqlookupd service for all it's topics and mirror it locally. |
| [**nsq-nodes**](https://github.com/mpneuried/nsq-nodes) | Nsq helper to poll a nsqlookupd service for all it's nodes and mirror it locally. |
| [**nsq-watch**](https://github.com/mpneuried/nsq-watch) | Watch one or many topics for unprocessed messages. |
| [**redis-sessions**](https://github.com/smrchy/redis-sessions) | An advanced session store for NodeJS and Redis |
| [**connect-redis-sessions**](https://github.com/mpneuried/connect-redis-sessions) | A connect or express middleware to simply use the [redis sessions](https://github.com/smrchy/redis-sessions). With [redis sessions](https://github.com/smrchy/redis-sessions) you can handle multiple sessions per user_id. |
| [**redis-notifications**](https://github.com/mpneuried/redis-notifications) | A redis based notification engine. It implements the rsmq-worker to safely create notifications and recurring reports. |
| [**hyperrequest**](https://github.com/mpneuried/hyperrequest) | A wrapper around [hyperquest](https://github.com/substack/hyperquest) to handle the results |
| [**task-queue-worker**](https://github.com/smrchy/task-queue-worker) | A powerful tool for background processing of tasks that are run by making standard http requests |
| [**soyer**](https://github.com/mpneuried/soyer) | Soyer is small lib for server side use of Google Closure Templates with node.js. |
| [**grunt-soy-compile**](https://github.com/mpneuried/grunt-soy-compile) | Compile Goggle Closure Templates ( SOY ) templates including the handling of XLIFF language files. |
| [**backlunr**](https://github.com/mpneuried/backlunr) | A solution to bring Backbone Collections together with the browser fulltext search engine Lunr.js |
| [**domel**](https://github.com/mpneuried/domel) | A simple dom helper if you want to get rid of jQuery |
| [**obj-schema**](https://github.com/mpneuried/obj-schema) | Simple module to validate an object by a predefined schema |

## License

(The MIT License)

Expand Down

0 comments on commit 678f4bf

Please sign in to comment.