<commit_before>import {TravelMarker} from "../../../map/index";
import {Subject} from "rxjs/Rx";
import {Travel} from "../../../travel/models/travel.model";
import {KuzzleDocument} from "../model/kuzzle-document.model";
/**
 * Handle each kuzzle calls related to the chat component.
 */
export class MapService {
    private kuzzle:Kuzzle;
    private travelMarkerStream:Subject<TravelMarker> = new Subject<TravelMarker>();

    public constructor(kuzzle:Kuzzle) {
        this.kuzzle = kuzzle;
    }

    /**
     * Persist and dipatch a marker to each people that subscribed to the given travel.
     *
     * @returns {any}
     */
    public publishTravelMarker(travelMarker:TravelMarker) {
        return this.kuzzle.dataCollectionFactory('markers').createDocument(travelMarker);
    }


    public getTravelMarkerStream():Subject<TravelMarker> {
        return this.travelMarkerStream;
    }

    public initTravelMarkersSubscriptionStream(travel:Travel) {
        var collectionName = 'markers';
        var filter = {
            query: {
                match: {
                    travelId: travel.id
                }
            }
        };

        // Get all notes from database<commit_msg>up the markers fetched limit<commit_after>import {TravelMarker} from "../../../map/index";
import {Subject} from "rxjs/Rx";
import {Travel} from "../../../travel/models/travel.model";
import {KuzzleDocument} from "../model/kuzzle-document.model";
/**
 * Handle each kuzzle calls related to the chat component.
 */
export class MapService {
    private kuzzle:Kuzzle;
    private travelMarkerStream:Subject<TravelMarker> = new Subject<TravelMarker>();

    public constructor(kuzzle:Kuzzle) {
        this.kuzzle = kuzzle;
    }

    /**
     * Persist and dipatch a marker to each people that subscribed to the given travel.
     *
     * @returns {any}
     */
    public publishTravelMarker(travelMarker:TravelMarker) {
        return this.kuzzle.dataCollectionFactory('markers').createDocument(travelMarker);
    }


    public getTravelMarkerStream():Subject<TravelMarker> {
        return this.travelMarkerStream;
    }

    public initTravelMarkersSubscriptionStream(travel:Travel) {
        var collectionName = 'markers';
        var filter = {
            size: 200,
            query: {
                match: {
                    travelId: travel.id
                }
            }
        };

        // Get all notes from database
{'fraction_non_alphanumeric': 0.1126530612244898, 'fraction_numerical': 0.0012244897959183673, 'mean_word_length': 2.4375876577840114, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3857398', 'n_tokens_mistral': 706, 'n_tokens_neox': 643, 'n_words': 161}