Skip to content

Commit 539718a

Browse files
authored
Merge pull request #39 from swiftype/fancy-readme
Adds fancy README
2 parents 9cd1532 + d4eb6aa commit 539718a

File tree

3 files changed

+51
-45
lines changed

3 files changed

+51
-45
lines changed

LICENSE.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
jQuery Plugin for Swiftype Site Search
2-
=========
1+
<p align="center"><img src="https://github.com/swiftype/swiftype-search-jquery/blob/master/logo-site-search.png?raw=true" alt="Elastic Site Search Logo"></p>
32

4-
The official [Swiftype Site Search](http://www.swiftype.com/site-search) jQuery plugin for adding search functionality backed by data from the Swiftype Site Search API. Learn more about Swiftype by visiting [swiftype.com](http://www.swiftype.com) and creating an account.
3+
> A first-party [Elastic Site Search](https://swiftype.com/documentation/site-search/overview) jQuery plugin for website search.
54
6-
> **Note:** This client has been developed for the [Swiftype Site Search](https://www.swiftype.com/site-search) API endpoints only. You may refer to the [Swiftype Site Search API Documentation](https://swiftype.com/documentation/site-search/overview) for additional context.
5+
## Contents
76

8-
Prerequisites
9-
------------
10-
1. A Swiftype account. Sign up at [swiftype.com](http://www.swiftype.com).
11-
2. A Swiftype Site Search engine with some data in it.
7+
+ [Getting started](#getting-started-)
8+
+ [Usage](#usage)
9+
+ [Customization tutorial](#customization-tutorial)
10+
+ [FAQ](#faq-)
11+
+ [Contribute](#contribute-)
12+
+ [License](#license-)
1213

14+
***
1315

14-
Installation
15-
------------
16+
## Getting started 🐣
17+
18+
Requirements:
19+
20+
1. Site Search account. Sign up at [swiftype.com](https://app.swiftype.com/signup).
21+
2. Site Search Engine with some data in it.
1622

1723
Include the following in the header of your webpage:
1824

@@ -30,9 +36,10 @@ All together it should look like this:
3036
<link type="text/css" rel="stylesheet" href="search.css" media="all" />
3137
```
3238

39+
> **Note:** This client has been developed for the [Elastic Site Search](https://www.swiftype.com/site-search) API endpoints only. You may refer to the [Elastic Site Search API Documentation](https://swiftype.com/documentation/site-search/overview) for additional context.
3340
34-
Basic Usage
35-
-----
41+
42+
## Usage
3643

3744
Start by having at least these three elements on the page: a form, an input field within the form, and a container for results.
3845

@@ -43,7 +50,7 @@ Start by having at least these three elements on the page: a form, an input fiel
4350
<div id="st-results-container"></div>
4451
```
4552

46-
Simply apply the swiftype method to an existing search input field within a form on your webpage and provide a container for results. For example, add it to a search input field with id `st-search-input` as follows:
53+
Apply the swiftype method to an existing search input field within a form on your webpage and provide a container for results. For example, add it to a search input field with id `st-search-input` as follows:
4754

4855
```js
4956
$('#st-search-input').swiftypeSearch({
@@ -54,17 +61,15 @@ $('#st-search-input').swiftypeSearch({
5461

5562
Be sure to change the `engineKey` attribute shown above to match the one assigned to your Swiftype search engine. If you are using the web interface, the search engine key is listed on the first page of your dashboard.
5663

57-
58-
Customization Tutorial
59-
-------------
64+
## Customization tutorial
6065

6166
This plugin is written to be flexible based on your specific use-case.
6267
For example you might want to retrieve more data for each result, customize
6368
the way data is display to the user, or restrict the search query to certain elements of your search engine.
6469

6570
Let's go through an example that does all of this. For this example, let's assume you followed the QuickStart tutorial for our [Ruby Gem](https://github.com/swiftype/swiftype-rb), and now you have data for a Bookstore indexed in your example search engine.
6671

67-
#### Changing the number of results per page
72+
### Changing the number of results per page
6873

6974
To specify the number of results per page, use the `perPage` attribute.
7075

@@ -96,7 +101,7 @@ The `highlightFields` option accepts a hash containing the fields you want to ha
96101

97102
See the [custom.html](https://github.com/swiftype/swiftype-search-jquery/blob/master/custom.html) file for an additional example of `highlightFields`.
98103

99-
#### Fetching only the fields you specify
104+
### Fetching only the fields you specify
100105

101106
To specify the fields you would like returned from the API, set the `fetchFields` attribute to a hash containing an array listing the fields you want returned for each document type. For example, if you have indexed `title`, `genre`, and `published_on` fields for each document, you can have them returned as follows:
102107

@@ -109,7 +114,7 @@ $('#st-search-input').swiftypeSearch({
109114

110115
These additional fields will be returned with each item, and they can be accessed in the rendering function as shown in the next section.
111116

112-
#### Customizing the display
117+
### Customizing the display
113118

114119
Now that you have more data for each result item, you'll want to customize the item rendering function to make use of them.
115120

@@ -140,7 +145,7 @@ $('#st-search-input').swiftypeSearch({
140145
});
141146
```
142147

143-
#### Restricting matching to particular fields
148+
### Restricting matching to particular fields
144149

145150
By default, the Swiftype search library will match the submitted query to any `string` or `text` field indexed for your documents. So if you would like to ensure that it only matches entries in the `title` field, for example, you can specify the `searchFields` option:
146151

@@ -155,7 +160,7 @@ $('#st-search-input').swiftypeSearch({
155160

156161
Similarly to the `fetchFields` option, `searchFields` accepts a hash containing an array of fields for each document_type on which you would like the user's query to match.
157162

158-
#### Specifying additional query conditions
163+
### Specifying additional query conditions
159164

160165
Now let's say you only want your results to display books that are of the **fiction** `genre` and are **in_stock**. In order to restrict search results, you can pass additional query conditions to the search API by specifying them as a dictionary in the `filters` field. Multiple clauses in the filters field are combined with AND logic:
161166

@@ -169,7 +174,29 @@ $('#st-search-input').swiftypeSearch({
169174
});
170175
```
171176

177+
## FAQ 🔮
178+
179+
### Where do I report issues with the client?
180+
181+
If something is not working as expected, please open an [issue](https://github.com/swiftype/swiftype-search-jquery/issues/new).
182+
183+
### Where can I learn more about Site Search?
184+
185+
Your best bet is to read the [documentation](https://swiftype.com/documentation/site-search).
186+
187+
### Where else can I go to get help?
188+
189+
You can checkout the [Elastic Site Search community discuss forums](https://discuss.elastic.co/c/site-search).
190+
191+
## Contribute 🚀
192+
193+
We welcome contributors to the project. Before you begin, a couple notes...
194+
195+
+ Before opening a pull request, please create an issue to [discuss the scope of your proposal](https://github.com/swiftype/swiftype-search-jquery/issues).
196+
+ Please write simple code and concise documentation, when appropriate.
197+
198+
## License 📗
199+
200+
[MIT](https://github.com/swiftype/swiftype-search-jquery/blob/master/LICENSE) © [Elastic](https://github.com/elastic)
172201

173-
Questions?
174-
----------
175-
Get in touch! We would be happy to help you get up and running.
202+
Thank you to all the [contributors](https://github.com/swiftype/swiftype-search-jquery/graphs/contributors)!

logo-site-search.png

25.7 KB
Loading

0 commit comments

Comments
 (0)