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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<SearchRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Bff.Dto.Search">
  <Offset>0</Offset>
  <Query>String</Query>
  <Rows>0</Rows>
  <SortBys>
    <SortByField>Relevance</SortByField>
  </SortBys>
  <Facets>
    <FilterAndFacetField>None</FilterAndFacetField>
  </Facets>
  <Filters>
    <FilterDto>
      <Field>None</Field>
      <FromValue>String</FromValue>
      <ToValue>String</ToValue>
      <Type>Equals</Type>
      <Values xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </Values>
    </FilterDto>
  </Filters>
</SearchRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<SearchResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Bff.Dto.Search">
  <DirectHit>
    <Destination>String</Destination>
    <Source>String</Source>
    <TopDestination>String</TopDestination>
  </DirectHit>
  <Facets>
    <FacetResultDto>
      <Field>None</Field>
      <Values xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringint>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value>0</d4p1:Value>
        </d4p1:KeyValueOfstringint>
      </Values>
    </FacetResultDto>
  </Facets>
  <HitItems>
    <HitItemDto>
      <Id>String</Id>
      <Score>0</Score>
      <ShortTitle>String</ShortTitle>
      <SourceId>0</SourceId>
      <SourceName>String</SourceName>
      <Status>String</Status>
      <Title>String</Title>
    </HitItemDto>
  </HitItems>
  <MatchingTokens xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </MatchingTokens>
  <TotalNumberOfHits>0</TotalNumberOfHits>
</SearchResponse>