<commit_before>//
//  Searchable.swift
//  Search
//
//  Created by <NAME> on 16/03/2016.
//  Copyright © 2016 Ordnance Survey. All rights reserved.
//

import Fetch
import OSTransformation

/**
*  Searchable protocol
*/
public protocol Searchable {
    /**
     Find the text specified

     - parameter query:      The text to find
     - parameter completion: Completion block to call
     */
    func find(query: String, completion: (Result<SearchResponse> -> Void))

    /**
     Find the nearest address to the provided grid point. Will find a result
     within 100 metres.

     - parameter location:   The location to query
     - parameter completion: Completion block to call
     */
    func nearest(location: OSGridPoint, completion: (Result<SearchResponse> -> Void))
}<commit_msg>Add bounding box search method to protocol<commit_after>//
//  Searchable.swift
//  Search
//
//  Created by <NAME> on 16/03/2016.
//  Copyright © 2016 Ordnance Survey. All rights reserved.
//

import Fetch
import OSTransformation

/**
 *  Searchable protocol
 */
public protocol Searchable {
    /**
     Find the text specified

     - parameter query:      The text to find
     - parameter completion: Completion block to call
     */
    func find(query: String, completion: (Result<SearchResponse> -> Void))

    /**
     Find the nearest address to the provided grid point. Will find a result
     within 100 metres.

     - parameter location:   The location to query
     - parameter completion: Completion block to call
     */
    func nearest(location: OSGridPoint, completion: (Result<SearchResponse> -> Void))
}

/**
 *  Extension to the searchable protocol that allows for a find query that 
 *  prioritises results within the specified bounding box
 */
public protocol BoundingBoxSearchable: Searchable {
    /**
     Find the specified text, prioritising results within the bounding box

     - parameter query:       The text to find
     - parameter boundingBox: The bounding box to search within
     - parameter completion:  Completion block to call
     */
    func find(query: String, boundingBox: OSBoundingBox, completion: (Result<SearchResponse> -> Void))
}
{'fraction_non_alphanumeric': 0.08589802480477722, 'fraction_numerical': 0.013780431786862656, 'mean_word_length': 2.8617021276595747, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6923529', 'n_tokens_mistral': 609, 'n_tokens_neox': 555, 'n_words': 229}