<commit_before>DotLedger.module('Views.Search', function () {
  this.FilterForm = Backbone.Marionette.ItemView.extend({
    template: 'search/filter_form',

    behaviors: {
      TagSelector: {},
      CategorySelector: {
        typeSelectable: true
      },
      AccountsSelector: {}
    },

    ui: {
      query: 'input[name=query]',
      category: 'select[name=category]',
      date_from: 'input[name=date_from]',
      date_to: 'input[name=date_to]',
      tags: 'select[name=tags]',
      account: 'select[name=account]',
      review: 'select[name=review]'
    },

    events: {
      'click button.search': 'search',
      'submit form': 'search'
    },

    onRender: function () {
      this.ui.review.append('<option value="">Any</option>');
      this.ui.review.append('<option value="true">Yes</option>');
      this.ui.review.append('<option value="false">No</option>');
      this.ui.review.val(this.model.get('review'));
      this.ui.query.val(this.model.get('query'));
      this.ui.date_from.val(this.model.get('date_from'));
      this.ui.date_to.val(this.model.get('date_to'));
      this.ui.date_from.datepicker({
        format: 'yyyy-mm-dd'
      });
      this.ui.date_to.datepicker({
        format: 'yyyy-mm-dd'
      });
      if (!this.model.has('category_id') && this.model.has('category_type')) {
        this.model.set('category_id', this.model.get('category_type'));
      } 
    },

    search: function () {
      var data;
      data = {};
      data['query'] = this.ui.query.val();
      if (this.ui.category.val()) {
        if (this.ui.category.val() > 0) {
          data['category_id'] = this.ui.category.val();
        } else if (this.ui.category.val() < 0) {
          data['unsorted'] = 'true';

        } else {<commit_msg>Fix bug where `Category: none` isn't persisted if the search result page is reloaded.<commit_after>DotLedger.module('Views.Search', function () {
  this.FilterForm = Backbone.Marionette.ItemView.extend({
    template: 'search/filter_form',

    behaviors: {
      TagSelector: {},
      CategorySelector: {
        typeSelectable: true
      },
      AccountsSelector: {}
    },

    ui: {
      query: 'input[name=query]',
      category: 'select[name=category]',
      date_from: 'input[name=date_from]',
      date_to: 'input[name=date_to]',
      tags: 'select[name=tags]',
      account: 'select[name=account]',
      review: 'select[name=review]'
    },

    events: {
      'click button.search': 'search',
      'submit form': 'search'
    },

    onRender: function () {
      this.ui.review.append('<option value="">Any</option>');
      this.ui.review.append('<option value="true">Yes</option>');
      this.ui.review.append('<option value="false">No</option>');
      this.ui.review.val(this.model.get('review'));
      this.ui.query.val(this.model.get('query'));
      this.ui.date_from.val(this.model.get('date_from'));
      this.ui.date_to.val(this.model.get('date_to'));
      this.ui.date_from.datepicker({
        format: 'yyyy-mm-dd'
      });
      this.ui.date_to.datepicker({
        format: 'yyyy-mm-dd'
      });
      if (!this.model.has('category_id')) {
        if (this.model.has('category_type')) {
          this.model.set('category_id', this.model.get('category_type'));
        } else if (this.model.has('unsorted')) {
          this.model.set('category_id', '-1');
        }
      } 
    },

    search: function () {
      var data;
      data = {};
      data['query'] = this.ui.query.val();
      if (this.ui.category.val()) {
        if (this.ui.category.val() > 0) {
          data['category_id'] = this.ui.category.val();
        } else if (this.ui.category.val() < 0) {
          data['unsorted'] = 'true';

        } else {
{'fraction_non_alphanumeric': 0.18780096308186195, 'fraction_numerical': 0.001337613697164259, 'mean_word_length': 2.571155682903534, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '372753', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1222, 'n_words': 175}