Skip to content

Commit 0561fc3

Browse files
author
David Harsha
authored
Merge pull request #32 from swiftype/davishmcclurg/readme
Double quotes! and rm whitespace
2 parents f85ebc2 + 54ed10d commit 0561fc3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ All together it should look like this:
2525

2626
```html
2727
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
28-
<script type='text/javascript' src='jquery.ba-hashchange.min.js'></script>
28+
<script type="text/javascript" src="jquery.ba-hashchange.min.js"></script>
2929
<script type="text/javascript" src="jquery.swiftype.search.js"></script>
3030
<link type="text/css" rel="stylesheet" href="search.css" media="all" />
3131
```
@@ -38,7 +38,7 @@ Start by having at least these three elements on the page: a form, an input fiel
3838

3939
```html
4040
<form>
41-
<input type='text' placeholder='Search' id='st-search-input' />
41+
<input type="text" placeholder="Search" id="st-search-input" />
4242
</form>
4343
<div id="st-results-container"></div>
4444
```
@@ -58,9 +58,9 @@ Be sure to change the `engineKey` attribute shown above to match the one assigne
5858
Customization Tutorial
5959
-------------
6060

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

6565
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.
6666

@@ -69,12 +69,12 @@ Let's go through an example that does all of this. For this example, let's assum
6969
To specify the number of results per page, use the `perPage` attribute.
7070

7171
```js
72-
$('#st-search-input').swiftypeSearch({
72+
$('#st-search-input').swiftypeSearch({
7373
engineKey: 'jaDGyzkR6iYHkfNsPpNK',
7474
perPage: 20
7575
});
7676
```
77-
77+
7878
The maximium value that will be honored by the API is 100.
7979

8080
#### Returning a matching highlight snippet
@@ -101,7 +101,7 @@ See the [custom.html](https://github.com/swiftype/swiftype-search-jquery/blob/ma
101101
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:
102102

103103
```js
104-
$('#st-search-input').swiftypeSearch({
104+
$('#st-search-input').swiftypeSearch({
105105
fetchFields: {'books': ['title','genre','published_on']},
106106
engineKey: 'jaDGyzkR6iYHkfNsPpNK'
107107
});
@@ -133,7 +133,7 @@ var customRenderFunction = function(document_type, item) {
133133
Now simply set the `renderFunction` attribute in the options dictionary to your `customRenderFunction` to tell our plugin to use your function to render results:
134134

135135
```js
136-
$('#st-search-input').swiftypeSearch({
136+
$('#st-search-input').swiftypeSearch({
137137
renderFunction: customRenderFunction,
138138
fetchFields: {'books': ['title','genre','published_on']},
139139
engineKey: 'jaDGyzkR6iYHkfNsPpNK'
@@ -145,22 +145,22 @@ $('#st-search-input').swiftypeSearch({
145145
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:
146146

147147
```
148-
$('#st-search-input').swiftypeSearch({
148+
$('#st-search-input').swiftypeSearch({
149149
renderFunction: customRenderFunction,
150150
fetchFields: {'books': ['title','genre','published_on']},
151151
searchFields: {'books': ['title']},
152152
engineKey: 'jaDGyzkR6iYHkfNsPpNK'
153153
});
154154
```
155155

156-
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.
156+
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.
157157

158158
#### Specifying additional query conditions
159159

160160
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:
161161

162162
```js
163-
$('#st-search-input').swiftypeSearch({
163+
$('#st-search-input').swiftypeSearch({
164164
renderFunction: customRenderFunction,
165165
fetchFields: {'books': ['title','genre','published_on']},
166166
filters: {'books': {'genre': 'fiction', 'in_stock': true}},
@@ -172,4 +172,4 @@ $('#st-search-input').swiftypeSearch({
172172

173173
Questions?
174174
----------
175-
Get in touch! We would be happy to help you get up and running.
175+
Get in touch! We would be happy to help you get up and running.

0 commit comments

Comments
 (0)