Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mikeisonthenets
Forked from ericgriffis/get_document.json
Last active July 15, 2016 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeisonthenets/45e287b738500197dcc4c2286658c7b5 to your computer and use it in GitHub Desktop.
Save mikeisonthenets/45e287b738500197dcc4c2286658c7b5 to your computer and use it in GitHub Desktop.
Swiftype API search issues
{
"external_id":"776c94748ed5f2cd0769c400deb855411e391225",
"engine_id":"55c5390cd3b687dbc9000012",
"document_type_id":"55c5390cd3b687dbc9000014",
"id":"577e0addc75d070216e6d7da",
"updated_at":"2016-07-15T07:55:49+00:00",
"site_domain":"http://dev.library.nyu.edu",
"url":"http://dev.library.nyu.edu/services/borrowing/nyu/day-shelf/",
"collection":"services",
"card_html":" <div class=\"item item--without-thumb\"> <h2 class=\"item__title\"> <a href=\"/services/borrowing/nyu/day-shelf/\" title=\"View more info on Day Shelf\">Day Shelf</a> </h2> <p class=\"item__meta\"> </p> </div>",
"title":"Day Shelf",
"departments":"Access, Delivery & Resource Sharing Services",
"location":"Elmer Holmes Bobst Library",
"stringified_departments":"Access, Delivery & Resource Sharing Services",
"position":5,
"sections":["Day Shelf","How to use the Day Shelf","Get Help","FAQs","Quick Links"],
"body":"Search the Library Services Borrowing From NYU & Consortium Libraries Day Shelf Elmer Holmes Bobst Library Temporarily leave books you don\u2019t want to check out immediately on the Day Shelf, located at the south end of the [Bobst Library Circulation & Reserves desk]. How to use the Day Shelf Insert a color laminated strip of paper from the box marked \u201cTODAY\u2019S COLOR\u201d into each of the books you are leaving on the shelf. Retrieve your books before Circulation & Reserves closes the following day. When you pick up your books, please return the flags in the box marked \u201cRETURN USED FLAGS HERE\u201d. Get Help FAQs See more Quick Links Circulation Desk Hours Chat with us \u2421",
"type":"",
"image":"",
"published_at":"2016-07-15T07:55:49Z",
"popularity":1,
"info":"",
"updated_at":"2016-07-13T21:19:47Z"
}
curl -X GET "https://api.swiftype.com/api/v1/engines/nyu-libraries/document_types/page/documents/577e0addc75d070216e6d7da.json?auth_token=${SWIFTYPE_API_KEY}"
curl -X GET 'https://api.swiftype.com/api/v1/public/engines/search.json' \
-H 'Content-Type: application/json' \
-d '{
"engine_key": "'"$SWIFTYPE_ENGINE_KEY"'",
"q":"Access, Delivery & Resource Sharing Services",
"filters": {"page": {"collection":"services"}},
"search_fields": {"page": ["stringified_departments"]},
"per_page":5,
"page":1
}'
@mikeisonthenets
Copy link
Author

The successful search result was partial matching on "Humanities" within the body field. stringified_departments wasn't being searched against because it wasn't being declared.

The current fields that are being searched against unless specifically defined are ['card_html', 'body', 'address', 'title', 'sections', 'info', 'phone', 'email', 'twitter', 'facebook']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment