<commit_before>module SolrPlugin::SearchHelper

  protected

  LIST_SEARCH_LIMIT = 20
  DistFilt = 200
  DistBoost = 50

  SortOptions = {
    catalog: {
      relevance: {option: ['Relevance', ''], solr_opts: {},
                  empty_solr_opts: {sort: 'solr_plugin_available_sortable desc, solr_plugin_highlighted_sortable desc, solr_plugin_name_sortable asc'}},
      name: {option: ['Name', 'name'], solr_opts: {sort: 'solr_plugin_available_sortable desc, solr_plugin_name_sortable asc'}},
      price: {option: ['Lowest price', 'price'], solr_opts: {sort: 'solr_plugin_available_sortable desc, solr_plugin_price_sortable asc'}},
      newest: {option: ['Newest', 'newest'], solr_opts: {sort: 'solr_plugin_available_sortable desc, created_at desc'}},
      updated: {option: ['Last updated', 'updated'], solr_opts: {sort: 'solr_plugin_available_sortable desc, updated_at desc'}},
    },
    products: {
      relevance: {label: _('Relevance')},
      name: {label: _('Name'), solr_opts: {sort: 'solr_plugin_name_sortable asc'}},
      more_recent: {label: c_('More recent'), solr_opts: {sort: 'created_at desc, score desc'}},
      #more_recent: {label: c_('More recent'), solr_opts: {boost_functions: ['recip(ms(NOW/HOUR,updated_at),1.3e-10,1,1)']}},
      closest: {label: _('Closest to me'), if: proc{ logged_in? && (profile=current_user.person).lat && profile.lng },
        solr_opts: {sort: "geodist() asc",
          latitude: proc{ current_user.person.lat }, longitude: proc{ current_user.person.lng }}},
    },
    events: {
      none: {label: _('Relevance')},<commit_msg>solr: use score instead of alphabetical order<commit_after>module SolrPlugin::SearchHelper

  protected

  LIST_SEARCH_LIMIT = 20
  DistFilt = 200
  DistBoost = 50

  SortOptions = {
    catalog: {
      relevance: {option: ['Relevance', ''], solr_opts: {},
                  empty_solr_opts: {sort: 'solr_plugin_available_sortable desc, solr_plugin_highlighted_sortable desc, score desc'}},
      name: {option: ['Name', 'name'], solr_opts: {sort: 'solr_plugin_available_sortable desc, solr_plugin_name_sortable asc'}},
      price: {option: ['Lowest price', 'price'], solr_opts: {sort: 'solr_plugin_available_sortable desc, solr_plugin_price_sortable asc'}},
      newest: {option: ['Newest', 'newest'], solr_opts: {sort: 'solr_plugin_available_sortable desc, created_at desc'}},
      updated: {option: ['Last updated', 'updated'], solr_opts: {sort: 'solr_plugin_available_sortable desc, updated_at desc'}},
    },
    products: {
      relevance: {label: _('Relevance')},
      name: {label: _('Name'), solr_opts: {sort: 'solr_plugin_name_sortable asc'}},
      more_recent: {label: c_('More recent'), solr_opts: {sort: 'created_at desc, score desc'}},
      #more_recent: {label: c_('More recent'), solr_opts: {boost_functions: ['recip(ms(NOW/HOUR,updated_at),1.3e-10,1,1)']}},
      closest: {label: _('Closest to me'), if: proc{ logged_in? && (profile=current_user.person).lat && profile.lng },
        solr_opts: {sort: "geodist() asc",
          latitude: proc{ current_user.person.lat }, longitude: proc{ current_user.person.lng }}},
    },
    events: {
      none: {label: _('Relevance')},
{'fraction_non_alphanumeric': 0.1577296958294136, 'fraction_numerical': 0.008153026026967701, 'mean_word_length': 4.666074600355239, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3945400', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1089, 'n_words': 239}