Skip to content

Instantly share code, notes, and snippets.

@iladriano
Created December 29, 2010 00:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iladriano/757969 to your computer and use it in GitHub Desktop.
Save iladriano/757969 to your computer and use it in GitHub Desktop.
test docvar_filters
require 'rubygems'
require 'indextank'
api_client = IndexTank::Client.new 'api url'
index = api_client.indexes 'eurotrip'
index.document('post4').add({ :text => '4I need my Duke.4'}, :variables => { 0 => 1, 1 => 4 })
index.document('post5').add({ :text => '5Duke Nukem is awesome.5'}, :variables => { 0 => 2, 1 => 5 })
index.document('post6').add({ :text => '6People who love Duke Nukem6'}, :variables => { 0 => 3, 1 => 6 })
index.search('Duke')
index.document('post4').add({ :text => '4I need my Duke. 4'}, :variables => { 0 => 1, 1 => 4 })
index.search('Duke')
index.search('Duke', :docvar_filters => { 0 => [[0,10]] } )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment