Hackathon2019

<back to all web services

SearchRequest

Requires Authentication
The following routes are available for this service:
POST,GET/api/searchSearch in legal sources
SearchRequest Parameters:
NameParameterData TypeRequiredDescription
FacetsbodyList<FilterAndFacetField>NoReturn search facets belonging to the search
FiltersbodyList<FilterDto>NoFilter search. Values are combined using the logical operator AND
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
FilterAndFacetField Enum:
None
DestinationName
DocumentId
SourceId
SourceName
Status
PublishYear
ContainsError
TopDestination
DocumentStatus
ContentCategory
LastFeeded
FilterDto Parameters:
NameParameterData TypeRequiredDescription
FieldformFilterAndFacetFieldNoThe field to filter on

Allowable Values

  • None
  • DestinationName
  • DocumentId
  • SourceId
  • SourceName
  • Status
  • PublishYear
  • ContainsError
  • TopDestination
  • DocumentStatus
  • ContentCategory
  • LastFeeded
ValuesformList<string>NoFilter search. If more than one values are combined using the logical operator OR
TypeformFilterTypeNoType if filter. Defaults to Equals

Allowable Values

  • Equals
  • NotEquals
  • RangeNumeric
  • RangeDate
FromValueformstringNoWhen using FilterType=Range*: FromValue is used as the lower boundary. Ie year >= 2009
ToValueformstringNoWhen using FilterType=Range*: FromValue is used as the upper boundary. Ie year >= 2019
FilterType Enum:
Equals
NotEquals
RangeNumeric
RangeDate
SearchResponse Parameters:
NameParameterData TypeRequiredDescription
HitItemsformList<HitItemDto>NoList of hits returned by the search
TotalNumberOfHitsformintNoTotal number of hits. Useful in pagination scenarios
DirectHitformDirectHitNoThe direct hit. If a search results in exactly ONE hit based on name / id / alias it is listed here. Example 'aml'
MatchingTokensformList<string>NoList of matching tokens returned in the search result
FacetsformList<FacetResultDto>NoList of Facets belonging to the search response. Can be used in a following filtered search to enable a drilldown search
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
DirectHit Parameters:
NameParameterData TypeRequiredDescription
TopDestinationformstringNoDocument id belonging to the direct hit
DestinationformstringNo(Sub)TopDestination belonging to the subdestination within the document
SourceformstringNoSource of the document
FacetResultDto Parameters:
NameParameterData TypeRequiredDescription
FieldformFilterAndFacetFieldNoThe facet field type. Can be used in a followup filtered search
ValuesformDictionary<string, int>NoA map of values and the belonging count

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/search HTTP/1.1 
Host: hackathon2019.rettsdata.no 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	facets: 
	[
		None
	],
	filters: 
	[
		{
			field: None,
			values: 
			[
				String
			],
			type: Equals,
			fromValue: String,
			toValue: 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,
	directHit: 
	{
		topDestination: String,
		destination: String,
		source: String
	},
	matchingTokens: 
	[
		String
	],
	facets: 
	[
		{
			field: None,
			values: 
			{
				String: 0
			}
		}
	]
}