Hackathon2019

<back to all web services

DocumentSearchRequest

Requires Authentication
The following routes are available for this service:
GET,POST/api/documentsearch/{TopDestination}Search within a document
DocumentSearchRequest Parameters:
NameParameterData TypeRequiredDescription
TopDestinationpathstringYesThe document id to search within
SearchRequestBase Parameters:
NameParameterData TypeRequiredDescription
QueryformstringNoThe query string to search for. Enable phrase search using " around the searchphrase. Otherwise a AND'ed termbased search is used
Rowsformint?NoNumber of rows to return
OffsetformintNoNumber of rows to skip. Use for pagination scenarios
SortBysformList<SortByField>NoSortBys to sort the result. Defaults to Relevance
SortByField Enum:
NameValue
Relevance0
DestinationNameAsc1
DestinationNameDesc2
SourceIdAsc3
SourceIdDesc4
SourceNameAsc5
SourceNameDesc6
SequenceAsc9
SequenceDesc10
DocumentSearchResponse Parameters:
NameParameterData TypeRequiredDescription
HitItemsformList<HitItemDto>NoList of hits within the document based on subdocument ids
TotalNumberOfHitsformintNoTotal number of hits. Useful in pagination scenarios
MatchingTokensformList<string>NoList of matching tokens returned in the search result
HitItemDto Parameters:
NameParameterData TypeRequiredDescription
IdformstringNoThe document id. Also known as TopDestination
SourceNameformstringNoThe source name
SourceIdformintNoThe source id. Can be used as a filtered query
TitleformstringNoThe document title
ShortTitleformstringNoThe document short title (if any)
ScoreformdoubleNoThe searches relevance score
StatusformstringNoThe documents legal status

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/documentsearch/{TopDestination} HTTP/1.1 
Host: hackathon2019.rettsdata.no 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	topDestination: String,
	query: String,
	rows: 0,
	offset: 0,
	sortBys: 
	[
		Relevance
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	hitItems: 
	[
		{
			id: String,
			sourceName: String,
			sourceId: 0,
			title: String,
			shortTitle: String,
			score: 0,
			status: String
		}
	],
	totalNumberOfHits: 0,
	matchingTokens: 
	[
		String
	]
}