README.md in rrf-0.1.0 vs README.md in rrf-0.1.1

- old
+ new

@@ -42,24 +42,24 @@ end ``` ### Performing Searches and Fusing Results -You can perform searches using ActiveRecord and Searchkick, and then fuse the results using the fuse method: +You can perform searches using ActiveRecord and Searchkick, and then fuse the results using the fuse method (the following relies on the [neighbor gem](https://github.com/ankane/neighbor) and the [red-candle gem](https://github.com/assaydepot/red-candle)): ```ruby # Configure the constant value if needed RRF.configure do |config| config.rank_bias = 70 # User-defined value end # Perform Searchkick search -es_result = Chunk.search("hi", load: false, limit: 50) +es_result = Chunk.search("alpaca", load: false, limit: 50) # Perform ActiveRecord nearest neighbor search -query_embedding = [0.1, 0.2, 0.3, ...] # Example embedding -ar_result = Chunk.where("body ilike ?", "%hi%").limit(50) +query_embedding = Candle::Model.new.embedding("alpaca") # You'd want to cache the model in memory +ar_result = Chunk.all.nearest_neighbors(:embedding768, query_embedding, distance: :cosine).limit(50) # Fuse the results and limit to 10 result = Chunk.fuse(ar_result, es_result, limit: 10) # `result` now contains the top 10 fused search results @@ -75,12 +75,43 @@ end ``` ## Development -After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment. +After checking out the repo, run -To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org. +```sh +bundle install +``` + +Then, run + +```sh +rake spec +``` +to run the tests. + +To install this gem onto your local machine, run + +```sh +bundle exec rake install +``` + +To release a new version, update the version number in version.rb, and then run + +```sh +bundle exec rake release +``` + +which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org. + +To use this locally during development, I like to include it whatever project I'm working by adding the following to the `Gemfile` of the other project + +```ruby +gem "rrf", path: '/what/ever/path/you/choose/rrf' +``` + +Then bundle and it will use your development copy. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/assaydepot/rrf.