22
33[ AddSearch] ( https://www.addsearch.com ) is a hosted search platform for all your web content. This API
44Client lets you easily use the [ AddSearch Search API] ( https://www.addsearch.com/support/api-reference/ )
5- from your JavaScript code. This client works on web browsers and with Node.js.
5+ from your JavaScript code on web browsers or with Node.js.
66
77## Quick Start
88``` js
@@ -17,9 +17,6 @@ var cb = function(res) {
1717
1818// Execute search. Callback function cb will be called with search results
1919client .search (' keyword' , cb);
20-
21- // Get search suggestions for a keyword
22- client .suggest (' api' , cb);
2320```
2421
2522## Publicly accessible functions
@@ -53,6 +50,32 @@ client.setLanguage('en');
5350client .setDateFilter (' 2019-01-01' , ' 2019-01-31' );
5451```
5552
53+ #### Define category filters
54+ Filter by URL patterns, document types or * addsearch-category* meta tag values.
55+ See [ full documentation.] ( https://www.addsearch.com/support/documentation/ranking-relevance-filters/filters/#category-filters )
56+
57+ ``` js
58+ // Only PDF files or products
59+ client .setCategoryFilters (' doctype_pdf,products' );
60+ ```
61+
62+ #### Custom field filters
63+ Filter by custom fields. Custon fields can be defined in meta tags or AddSearch crawler can pick them up from your HTML or JSON data.
64+ See [ full documentation.] ( https://www.addsearch.com/support/documentation/ranking-relevance-filters/custom-field/ )
65+
66+ ``` js
67+ // Search by specific city (Berlin, Paris or Boston)
68+ client .addCustomFieldFilter (' city' ,' berlin' );
69+ client .addCustomFieldFilter (' city' ,' paris' );
70+ client .addCustomFieldFilter (' city' ,' boston' );
71+
72+ // Remove paris (Berlin and Boston remaining)
73+ client .removeCustomFieldFilter (' city' ,' paris' );
74+
75+ // Remove all cities
76+ client .removeCustomFieldFilter (' city' );
77+ ```
78+
5679#### Manage paging
5780``` js
5881// Defaults: page "1", pageSize "10", sortBy "relevance", sortOrder "desc"
@@ -65,31 +88,35 @@ client.nextPage();
6588client .previousPage ();
6689```
6790
68- ## Browser support
69- The client is tested on following browsers
91+ ## Supported web browsers and node.js versions
92+ The client is tested on
7093- Chrome
7194- Firefox
7295- Edge
7396- Safari 6.1+
7497- Internet Explorer 10+
98+ - Node.js 4+
99+
75100
76101## Development
77102To modify this client library, clone this repository to your computer and execute following commands.
78- ### Install dependencies
103+ #### Install dependencies
79104``` sh
80105npm install
81106```
82107
83- ### Run tests
108+ #### Run tests
84109``` sh
85110npm test
86111```
87112
88- ### Build
89- To build the client, run:
90-
113+ #### Build
91114``` sh
92115npm run build
93116```
94117
95- Built bundle is saved under the * dist/* folder
118+ Built bundle is saved under the * dist/* folder
119+
120+ ## Support
121+
122+ Feel free to semd any questions, ideas and suggestions at [ support@addsearch.com ] ( support@addsearch.com ) .
0 commit comments