<commit_before># search_operators
Implements a simple parser for search strings using **key:value**.


The following search string is supported:

```
user_id: 123 user_name: omg user_id: 124 free text here
```


Usage:

```ruby

search = SearchOperators.new query
search.operator('user_id', :integer) do |val|
  # this block will be called twice with val being set to '123' and '124'
end

search.as_array('user_id') do |arr|
  # this block will be called once, with an array of strings ['123', '124']
end


search.free_text do |txt|
  # this block is called with the remaining text
end
```

This is particular useful for appending search criteria to your rails query ;)

You can see all the available methods by reading the tiny source code. :D

Each method supports a 2nd optional parameter indicating the expected format of the field. Valid options are:

* :string (default)
* :integer
* rails model (well, anything with `.find` method)
<commit_msg>example fixed<commit_after># search_operators
Implements a simple parser for search strings using **key:value**.


The following search string is supported:

```
user_id: 123 user_name: omg user_id: 124 free text here
```


Usage:

```ruby

search = SearchOperators.new query
search.operator('user_id', :integer) do |val|
  # this block will be called twice with val being set to '123' and '124'
end

search.as_array('user_id') do |arr|
  # this block will be called once, with an array of strings ['123', '124']
end


search.freetext do |txt|
  # this block is called with the remaining text
end
```

This is particular useful for appending search criteria to your rails query ;)

You can see all the available methods by reading the tiny source code. :D

Each method supports a 2nd optional parameter indicating the expected format of the field. Valid options are:

* :string (default)
* :integer
* rails model (well, anything with `.find` method)

{'fraction_non_alphanumeric': 0.08627038400841662, 'fraction_numerical': 0.019989479221462388, 'mean_word_length': 4.52906976744186, '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': '5572113', 'n_tokens_mistral': 590, 'n_tokens_neox': 537, 'n_words': 265}