Giter Club home page Giter Club logo

itemsjs's Introduction

npm version GitHub package.json version NPM monthly downloads GitHub license

ItemsJS - search engine in javascript

Extremely fast faceted search engine in JavaScript - lightweight, flexible, and simple to use. Created to perform fast search on json dataset (up to 100K items).

Demo

demo

See another demo examples

Use cases

Itemsjs is being used mostly for data classification of companies, products, publications, documents, jobs or plants

The solution has been implemented by people from Amazon, Hermes, Apple, Microsoft, James Cook University, Carnegie Mellon University and more. You can find a list of real implementations - here

Features

  • Ultra-fast faceted search: Process and filter data with blazing speed.
  • Simple full-text search: Intuitive and straightforward text searching.
  • Relevance scoring: Rank search results based on relevance.
  • Facet filtering and sorting: Filter and order results by various facets.
  • Pagination
  • Works on both backend and frontend
  • Integration with custom full-text search engines

Getting Started

NPM

npm install itemsjs

Using CommonJS syntax

const itemsjs = require('itemsjs')(data, configuration);
const items = itemsjs.search();

Using ES Module syntax

import itemsjs from 'itemsjs';
const searchEngine = itemsjs(data, configuration);
const items = searchEngine.search();

Client side

To use as an UMD in the browser:
<!-- CDN -->
<!-- unpkg: use the latest release -->
<script src="https://unpkg.com/itemsjs@latest/dist/index.umd.js"></script>
<!-- unpkg: use a specific version -->
<script src="https://unpkg.com/[email protected]/dist/index.umd.js"></script>
<!-- jsdelivr: use a specific version -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.js"></script>
<script>
  itemsjs = itemsjs(data, configuration);
  itemsjs.search()
</script>
To use as an ES module in the browser:
<!-- Include as ES Module -->
<script type="module">
  import itemsjs from 'https://unpkg.com/[email protected]/dist/index.module.js';
  // Initialize and use itemsjs here
  const searchEngine = itemsjs(data, configuration);
  searchEngine.search();
</script>

Example usage

npm install itemsjs

# download json data
wget https://raw.githubusercontent.com/itemsapi/itemsapi-example-data/master/items/imdb.json -O data.json

Next, create a search.js file with the following content:

const data = require('./data.json');

const itemsjs = require('itemsjs')(data, {
  sortings: {
    name_asc: {
      field: 'name',
      order: 'asc'
    }
  },
  aggregations: {
    tags: {
      title: 'Tags',
      size: 10,
      conjunction: false
    },
    actors: {
      title: 'Actors',
      size: 10
    },
    genres: {
      title: 'Genres',
      size: 10
    }
  },
  searchableFields: ['name', 'tags']
});

/**
 * get filtered list of movies 
 */
const movies = itemsjs.search({
  per_page: 1,
  sort: 'name_asc',
  // full text search
  // query: 'forrest gump',
  filters: {
    tags: ['1980s']
  }
})
console.log(JSON.stringify(movies, null, 2));

/**
 * get list of top tags 
 */
const top_tags = itemsjs.aggregation({
  name: 'tags',
  per_page: 10
})
console.log(JSON.stringify(top_tags, null, 2));

Run your script with Node.js:

node search.js

Integrations

If native full text search is not enough then you can integrate with external full text search.

How it works:

  • each item of your data needs to have id field. It can be also custom field but it needs to be defined.
  • native_search_enabled option in configuration should be disabled
  • index data once in your search and itemsjs
  • make search in your custom search and provide ids data into itemsjs
  • done!

Examples:

API

const itemsjs = ItemsJS(data, [configuration])

data

The first data argument is an array of objects.

configuration

Responsible for defining global configuration. Look for full example here - configuration

  • aggregations filters configuration i.e. for tags, actors, colors, etc. Responsible for generating facets.

    Each filter can have it's own configuration. You can access those as buckets on the search() response.

    • title Human readable filter name
    • size Number of values provided for this filter (Default: 10)
    • sort Values sorted by count (Default) or key for the value name. This can be also an array of keys which define the sorting priority
    • order asc | desc. This can be also an array of orders (if sort is also array)
    • show_facet_stats true | false (Default) to retrieve the min, max, avg, sum rating values from the whole filtered dataset
    • conjunction true (Default) stands for an AND query (results have to fit all selected facet-values), false for an OR query (results have to fit one of the selected facet-values)
    • chosen_filters_on_top true (Default) Filters that have been selected will appear above those not selected, false for filters displaying in the order set out by sort and order regardless of selected status or not
    • hide_zero_doc_count true | false (Default) Hide filters that have 0 results returned
  • sortings you can configure different sortings like tags_asc, tags_desc with options and later use it with one key.

  • searchableFields an array of searchable fields.

  • native_search_enabled if native full text search is enabled (true | false. It's enabled by default)

  • isExactSearch set to true if you want to always show exact search matches. See lunr stemmer and lunr stopWordFilter.

  • removeStopWordFilter set to true if you want to remove the stopWordFilter. See #46.

itemsjs.search(options)

options

  • per_page amount of items per page.

  • page page number - used for pagination.

  • query used for full text search.

  • sort used for sorting. one of sortings key

  • filters filtering items based on specific aggregations i.e. {tags: ['drama' , 'historical']}

  • filter function responsible for items filtering. The way of working is similar to js native filter function. See example

  • filters_query boolean filtering i.e. (tags:novel OR tags:80s) AND category:Western

  • is_all_filtered_items set to true if you want to return the whole filtered dataset.

itemsjs.aggregation(options)

It returns full list of filters for specific aggregation

options

  • name aggregation name
  • per_page filters per page
  • page page number
  • query used for quering filters. It's not full text search
  • conjunction true (Default) stands for an AND query, false for an OR query

itemsjs.similar(id, options)

It returns similar items to item for given id

options

  • field field name for computing similarity (i.e. tags, actors, colors)
  • minimum what is the minimum intersection between field of based item and similar item to show them in the result
  • per_page filters per page
  • page page number

itemsjs.reindex(data)

It's used in case you need to reindex the whole data

data

An array of objects.

itemsjs's People

Contributors

aurelienroux avatar bartel-c8 avatar cigolpl avatar claudedufour74 avatar crabatel avatar dependabot[bot] avatar domoritz avatar joostmeijles avatar julievalet avatar letrab avatar mulquin avatar noraj avatar ruitjes avatar sergeyre avatar stereobooster avatar tordans avatar vanch3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

itemsjs's Issues

Overriding the 1000 item limit

According to the project description, there's a 1000 element limit. Is there anyway to override this? I haven't run into that limit yet, but I'd like to get ahead of it in case I do.

Full text, faceted, dependency free search engine in javascript. Created to perform fast search on small json dataset (up to 1000 elements).

Problem with accessing itemsjs in VanillaJS

After integration nwb and after loading itemsjs.js script I've encountered a obstacle with accessing itemsjs global variable for initializing search in vanillajs

This might be helpful for reproducing:

<html>
   <head>
      <!--the old version built with browserify. it's returning object correctly -->
      <!--<script src="https://unpkg.com/[email protected]/dist/itemsjs.min.js"></script>-->
      <!--the new version with nwp building. it's throwing an error: TypeError: itemsjs is not a function  -->
      <script src="https://cdn.rawgit.com/itemsapi/itemsjs/master/dist/itemsjs.min.js"></script>
   </head>
   <body>
      <script>
        // it should print an object like below:
        // {search: ƒ, aggregation: ƒ, reindex: ƒ}
        console.log(itemsjs());
      </script>
   </body>
</html>

@saminzadeh any idea how it could be solved ?

Adding an aggregation which is not a collection property (e.g. years) breaks search

Hi,
This is a very interesting and extremely useful project.

I'm just encountering a slight problem when I extend the filter configuration with a pure 'scalar' value.
In order to situate the problem as clear as problem, allow me to refer to your movie sample.
(https://jsfiddle.net/cigol/0ef9qeos/5/)
When in this sample, you change the configuration as follows:

    year: {
      title: 'Year',
      size: 10
    }

the search isn't working any longer.
Did I miss something?
You can find the updated jsfiddle reproducing the problem here as well:
https://jsfiddle.net/paulvb/86xbs4jd/
So, basically the 'year list', the bucket list so to speak is built up correctly but when you select a year, things break.

Thanks a lot
paul.

Conjunction between categries

Hi,

A faceted search page in an application I am working on requires that the filter that is applied on the items acts as a conjunction of category disjunctions.

For example,
Having the following items -
items = [
{a: 1, b: 2},
{a: 2, b: 3}
{a: 2, b: 2} ]

With the following filters -
filters = {a: [1, 2], b: [2]}
My desired result would be = [
{a: 1, b: 2},
{a: 2, b: 2} ]

But actually I get = [
{a: 1, b: 2},
{a: 2, b: 3}
{a: 2, b: 2} ]

In other words I'm trying to get (a in (1,2) AND b = 2) but getting (a in (1,2) OR b = 2)...
I am unsure how (if possible) this can be done, and will appreciate some assistance. 😄

Thanks,
Ittai.

[Chore] tags and release

There are git tags only up to v1.0.30. So version between 1.0.31 (4 years ago) to 1.0.49
(2 years ago) and also the whole 2.x.x (2.0.0 to 2.1.10) are released on npmjs but have no git tag.

Configurable `id` property on full-text search: Lunr2 integration

As documented in https://github.com/itemsapi/itemsjs/blob/master/docs/lunr2-integration.md it is possible to use Lunr2 for full-text searching.

I want to try to use this, because I need nested/deep object search (which is possible via the extractor of a field https://lunrjs.com/docs/lunr.Builder.html#field )

But, my data set has no id property, but e.g. a unique property uuid. So it would be nice to make this property configurable in order to be more flexible on this.

Unnecessary override of the title property in the buckets creation

The configuration for an aggregation defines a title property, such as:

{
  aggregations: {
    tags: {
      title: 'Tags',
      // conjunctive facet (AND)
      conjunction: true,
      // the default is 10
      size: 20
    },
    rating: {
      title: 'Actors',
      // non conjunctive facet (OR)
      conjunction: false,
      // it is sorting by value (not by count). 'count' is the default
      sort: 'term',
      order: 'asc',
      size: 5
    }
  }
}

I assumed it could be used for the UI part of the facets, once the search has been succesful.
But the code for creating the buckets automatically generates a title property out of a humanised version of the id, see

itemsjs/src/helpers.js

Lines 236 to 241 in 06e2e70

return {
name: k,
title: humanize(k),
position: position++,
buckets: buckets
};

  • Is title used anywhere else in the code or by other integrations?
  • Would it make sense to use the humanised version only is the title has not been defined in the configuration, e.g.
return {      
    name: k,      
    title: aggregations[k].title || humanize(k),      
    position: position++,      
    buckets: buckets    
};

Feature request - min and max values

Hello Cigolpl,

Thanks for the library.

I would like to use the min and max values from numeric fields, e.g. price. These are the min and max values, after searching/filtering the data set. It is handy for dynamically updating the min and max value in a range input.

Is there a way to do this or is this something you are working on?

window.itemsjs not a function

It seems like the last commit broke the library. I am getting this error when attempting to initialize it (Using it client side). I thought the last change was supposed to provide ES5 compatibility.

Ideas?

How to show search?

I want to construct a simple hello world search example application, but the README does not show how one is supposed to actually show the search. How can I tell itemsjs where my container is so that it is shown?

I cannot follow the examples because they all use external frameworks like Vue and React, which I don't.

Is it impossible to use itemsjs without Vue and React?

At https://jsfiddle.net/wnhao0qc/1/ is my example:

HTML

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">		
		<script src="https://unpkg.com/itemsjs@latest/dist/itemsjs.min.js"></script>	
	</head>
	<body onload="main();">
	</body>
</html>

JavaScript

const config = {
  sortings: {
    bezeichnung: {
      field: 'id',
      order: 'asc'
    }
  },
  aggregations: {
    tags: {
      title: 'begriffsklasse',
      size: 3
    }
  },
  searchableFields: ['id', 'synonyme','definition','begriffsklasse']
};

const data = [
{id: "id1", name: "peter"},
{id: "id2", name: "bob"},
{id: "id3", name: "alice"}
];

function main()
{
  itemsjs = itemsjs(data, config);
  const search = itemsjs.search(); // <<<<<<<<<<------- this should create the search UI but nothing happens, the screen is blank
  console.log(search);
}

The problem is that itemsjs.search() does nothing, which is understandable, because I didn't point it to a rendering container. What do I to do to show it?

Chinese text filtering does not work

Tried using this

const [testProducts] = useState(
    ItemsJs([
      {
        id: 1,
        name: "安积 ASAKA THE FIRST  单一麦芽威士忌 700 M L",
      },
      {
        id: 2,
        name: "麦卡伦18年双桶单一麦芽威士忌 700 M L",
      }
    ], {
      sortings: {
        nameasc: {
          field: 'name',
          order: 'asc',
        },
      },
      searchableFields: ['name'],
    })
  );

  console.log('test1', testProducts.search({
    per_page: 100,
    sort: 'nameasc',
    query: '麦芽威士忌',
  }));
  console.log('test2', testProducts.search({
    per_page: 100,
    sort: 'nameasc',
    query: 'ASAKA',
  }));
  console.log('test3', testProducts.search({
    per_page: 100,
    sort: 'nameasc',
    query: '700',
  }));

test 1 does not return any results
test 2 shows 1 result as expected
test 3 shows 2 result as expected

Assymetry in aggregations doc_count calculation

Developing with itemsjs i found strange assymetry in doc_count calculation for first and second facets
To reproduce this artefact i made fork of your jsfiddle demo
i exclude third facet and cutted dataset to 4 items
and made next combination of Tags,Actors fields:
prison,Tim Robbins
mafia,Tim Robbins
prison,Christan Bale
mafia,Christan Bale
2 facets are symmetrical and simalar behavior is expected -see my demo
but.... if you check 2 different facet values -you ll see strange assymentry in doc count calculation for different facets
printscreen supplied

Facet results for a given filter

Hi @cigolpl,
I'm not sure how facets usually work but I try to implement filters with count, something like this:

image

What is expected:
When search returns results for a given filter value, the filter value should be part of the aggregation object.

What happens:
When search returns results for a given filter value, the filter is not part of the aggregation object

I made a quick demo in the console (look at init console) https://codepen.io/lbineau/pen/RLxXKd?editors=0012

Is it a bug or a normal behavior?

Prefilter is confusing

I'm very confused by the prefiltering method and would appreciate your help and some improvements to the docs.

  • The grammar is odd. What does it mean to make something prefiltering?
  • The function is not valid js.
  • itemsjs.prefilter is also not defined

It is making items prefiltering before search or aggregation, i.e.:

itemsjs.prefilter(items) {
  return items.filter(item => {
    return item.price > 100;
  });
}

[Chore] Changelog

Issue

The project has no changelog.

Example of context

I updated from v1 to v2 and my search form broke (as expected there are breaking changes in major versions)

-    "itemsjs": "^1.0.49",
+    "itemsjs": "^2.1.10",

Now I have to fix my code but since there is no changelog I have no clue in which version a breaking change was introduced nor what or where it is.

Solution

Document all changes in a changelog.

Case-insensitive sorting or custom sort

Is there an option to set so that sorting is case-insensitive?
Or is there a way to define custom search where one could implement case-insensitive sort?
Thanks

Faceted search with OR

Hi @cigolpl,
Thank you for your library, it is really nice, I have been looking for a while for a proper faceted search lib without jQuery.

I have a question about the faceted search.

var movies = itemsjs.search({
  per_page: 1,
  sort: 'name_asc',
  filters: {
    tags: ['1980s', '1990s']
  }
})

Will return all movies with 1980s AND 1990s tags.
Is it possible to search with OR operator? If I want all movies with 1980s OR 1990s.

Thanks a lot.

json from fetch api is not working

While the example uses a js file with a variable in it I try to fetch data and return it a json. itemsjs does not recognize the array. Providing the identical data as js like in the example works fine.
fetch-vs-var

Allow "like" search query

Currently using this list of items:

  • V1001
  • P1001
  • 1001
  • Basic
    and entering 100 in the search field, only 1001 will be returned.
    When entering `asic, Basic wil not be returned.

I have looked #28 but could not find the proper "token" for what I am looking for.

I wonder if there is a configuration setting allowing the like searchers.
I've tried wrapping the query value between * à la Lurnr.js but I think those are escaped by ItemsJS.

Thanks.

Improvement request : buckets sort

It could be interesting to be able to sort buckets (alphabetically at least) or by any other possible criteria.

We wish see such as feature soon in your module.

Best Regards!

Failing example in readme.md

Hi,

I'm testing the library using the example of README.md,

but it fails:

At:   node_modules/fastbitset/FastBitSet.js:488

const count = Math.max(this.words.length, otherbitmap.words.length);
TypeError: Cannot read properties of undefined (reading 'words')

bug with selected value for boolean facet

to reproduce:

const data = [{ "boolean": true, "string": "true" }]
const itemsjs = require('itemsjs')(data, {
    aggregations: {
        boolean: {},
        string: {}
    }
});

const aggs = itemsjs.search({
    filters: {
        boolean: [true],
        string: ["true"]
    }
}).data.aggregations

console.log(aggs.boolean.buckets, aggs.string.buckets)

//[{ key: 'true', doc_count: 1, selected: false }][{ key: 'true', doc_count: 1, selected: true }]`

for comparison there 2 fields : boolean and string . Both are aggregations and search made under both of them
in first case we have "selected:false" for boolean ( looks like a bug) and "selected:true" for string ( its OK)

Always show selected filter/facet (on top)

Hi!

Currently, selecting facets/filters can become confusing, as by default apparently, a selected filter will not always be visible.

Eg: https://jsfiddle.net/cigol/0ef9qeos/5/

First select "Morgan Freeman" from the actors. Secondly select "falling into a well" as tag.
Now "Morgan Freeman" is not shown in the actors list anymore... So it's impossible to unselect it again as well...

Is there an option to always show it (on top)?

Thanks!

Filter seems to break pagination

I've slightly modified the demo example code given in the documentation of the IMDB search with pagination to illustrate the problem. I added a simple filter to the options given to itemsjs.search, and the result is that clicking past page 1 does not show any results. This was the only change I made to the example code:

filter: (item) => { return item.year > 1994; }

Fiddle here: https://jsfiddle.net/awhalen/5wmL9jv2/

Perhaps I'm misusing or misunderstanding filter, or maybe I should use prefilter (which doesn't actually seem to do anything?). Thanks.

How to filter down with "exact" match?

I went through the readme extensively but could not find what I am looking for.

it seems that by default if I do

itemsJS.search({
  filters: [
     brands: ['toshi']
  ]
});

Every entries with brands

  • toshi
  • toshiba
  • kitoshi

will be returned as results.

Is there a way to only return entries which have the brand toshi?

Supporting filtering for a value range

Hi,

I would like to know whether it's possible to configure the library to filter for min-max value. For example, a list of items that has a price attribute where I can show a slider with a min/max value that gets filtered.

As of now it works great for item lists.

Update to Lunr 2

It would be great if itemsjs could be updated to the latest version of lunr. I'm running into some issues with the old set implementation and it looks like the new version does not have this issue anymore.

Aggregations are always ordered by selected item first

Hi,
Can we make aggregations sorting more flexible, to prevent the selected items from going to the top of the list

here an example :

image

when I select 2022, it go to the top of the list, in my case it should stay at it initial position (ordered by terms)
image

It make some confusion for users when selecting many items :
the affected code is in the helper.js file :

if (sort === 'term') {
buckets = _.orderBy(buckets, ['selected', 'key'], ['desc', order || 'asc']);
} else {
buckets = _.orderBy(buckets, ['selected', 'doc_count', 'key'], ['desc', order || 'desc', 'asc']);
}

the 'selected' key is hard coded in this file, it should be more flexible so we can order with custom criteria , or simply remove the 'selected' param if not needed.

Thanks

update items list - in what lifecycle hook to put itemsjs()

I use this tool in a Vue SPA where the user can add items. Up to now I run itemsjs() as a static procedure before page creation. what would be the correct lifecycle hook to put itemsjs() to reevaluate the items list after the user adds an item?

Transpile code to ES5 before publishing to NPM

First off, thanks for developing this lib. It's really nice.

I am running into a minification issue because the code published to NPM isn't transpiled to ES5 (I noticed there are some => functions in the dist). This is causing issues when trying to build it with create-react-app.

I'll be glad to submit a PR for this

Asking for help, search nested objects

Hi
I kindly ask for some help regarding searching objects.
All the examples I have seen, assume that the item list has a structure similar to :
var rows = [
{

"runtime": 142,
"country": [
  "USA"
],
"tags": [
  "prison",
  "wrongful imprisonment",
 ], .....

Then
aggregation filters (and more)
aggregations: {
tags: {
title: 'Tags',
size: 10,
conjunction: true
},
Now this makes it possible to search tags for the values, but imagine that tags in rows would not be a list of string but a list objects
{ desc: "A super tag",
created: "some date" }

How would you filter that ?

Thank you
regards
Tommy

[chore] NPM

is it possible to publish a package on npmjs ?

[Feature Request] Support both conjunctions in aggregations

Hello! I think this is a feature request, but let me know if this is already possible. Given something like before

{
  genre: Action,
  tags: ['Dark', 'Happy', 'Sad'],
}, 
{
  genre: Adventure
  tags: ['Mysterious']
}

I would love to be able to support both stories of

  1. Show me any movie that is Genre: Action AND Tag:Dark AND Happy

or

  1. Show me any movie that is Genre: ACTION OR Tag: Dark AND Happy

Basically support different kinds of ways to slice and dice the data

This is a great library, feels like one of the only in-browser libraries that supports facets!

Full text search example

Hi @cigolpl,

The search with facets are working very well but I can't find an example of full text search.
I see in the source code that you use lunrjs. Can you provide me a code sample with full text search and the fields to limit the search to?

Equivalent with lunrjs code

var idx = lunr(function () {
  this.field('title')
  this.field('body')

  this.add({
    "title": "Twelfth-Night",
    "body": "If music be the food of love, play on: Give me excess of it…",
    "author": "William Shakespeare",
    "id": "1"
  })
})
idx.search("love")

Another unrelated question, I saw you use the full library minified of lodash without npm. What is the reason behind it ? I'm also using lodash but with npm so I think lodash code will be duplicated in the end because there is no dependencies manager.
I could fork the project and do the modifications if it is not a deliberate choice.

Get complete list of facet values (even when not in the result set), with doc_count=0

Very useful library, I love it.

Is there an option in the configuration to always return the full set of values for an aggregation, even for values that do not correspond to any item in the result set, with doc_count set to 0 ?

Or is there a workaround for this ? (I can retrieve the complete list of values for an aggregation by triggering an empty search, but it would be much more convenient in my situation to consistently retrieve complete list of values to update the view with all values, and set colors/icons according to if the value is selected and if it has some results).

Cheers

How to prefilter search, when passing paramenter from URL

Hi guys,

I have a URL that is passing some parameters (strings), that I want the search page to have filtered when you land on the page :

v-careers-search-page.html?careerssearch=xxx&Job_family_group=xxx&Organisation_name=xxx&Primary_location_country=GB

so for example when I land on the search page, I would like the 'Primary_location_country' checkbox to prefilter all GB countries, but also be able to filter any other options given from GB

hope this makes sense..

cheers,
A

Is there an adapter for redissearch

I just discovered itemsjs and i am interested in using it with redissearch. Has anyone built an adapter for redissearch already?

I trying to us itemsjs with redissearch

Paged filtered search not returning items

When using filter with paging I do not get any results back.

Test case:

it('paged filtered search', function test(done) {
    const items = [{ id: 1 }, { id: 2 }, { id: 3 }];
    const index = require('./../index')(items);
    
    const res = index.search({
      query: '',
      page: 2,
      per_page: 1,
      filter: (item) => item.id > 1,
    });
    assert.deepEqual(res.data.items, [{ _id: 3, id: 3 }]);

    done();
  });

Is this a bug or am I using it wrongly?

Help with pagination needed

Hi @cigolpl,

you have created an awesome library!

I am trying to adapt it for a bibliography list and currently am stuck at how to paginate through the items. While looking around I also noticed that the example you provided on jsfiddle does not provide pagination. There a 100 search results are mentioned, but only the first 12 items can be seen.

What am I missing?

help with install

Hi @cigolpl,

great job with this one.

I am trying to replicate a search app like http://devteams.co/ on localhost but i have trouble making it work.
I have looked at the documentation but it seems i am doing something wrong.

Could you provide a step by step clear instruction on how to make it run localhost?

Thank you so much

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.