picky

https://github.com/floere/picky

HTML

Picky is an easy to use and fast Ruby semantic search engine that helps your users find what they are looking for.

Picky::Index#category

API method.

Defines a searchable category on the index.

=== Parameters
* category_name: This identifier is used in the front end, but also to categorize query text. For example, “title:hobbit” will narrow the hobbit query on categories with the identifier :title.

=== Options
* indexing: Pass in either a tokenizer or tokenizer options.
* partial: Partial::None.new or Partial::Substring.new(from: starting_char, to: ending_char). Default is Partial::Substring.new(from: -3, to: -1).
* similarity: Similarity::None.new or Similarity::DoubleMetaphone.new(similar_words_searched). Default is Similarity::None.new.
* qualifiers: An array of qualifiers with which you can define which category you’d like to search, for example “title:hobbit” will search for hobbit in just title categories. Example: qualifiers: [:t, :titre, :title] (use it for example with multiple languages). Default is the name of the category.
* qualifier: Convenience options if you just need a single qualifier, see above. Example: qualifiers => :title. Default is the name of the category.
* source: Use a different source than the index uses. If you think you need that, there might be a better solution to your problem. Please post to the mailing list first with your application.rb :)
* from: Take the data from the data category with this name. Example: You have a source Sources::CSV.new(:title, file:'some_file.csv') but you want the category to be called differently. The you use from: category(:similar_title, :from => :title).

Source | Google | Stack overflow

Edit

git clone [email protected]:floere/picky.git

cd picky

open server/lib/picky/index.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Picky--Index-category-for-pr


# Commit to git

git add server/lib/picky/index.rbgit commit -m "better docs for Picky::Index#category"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Picky--Index-category-for-pr

hub pull-request


# Celebrate!