Skip to content

Instantly share code, notes, and snippets.

@Nogbit
Last active December 28, 2015 07:18
Show Gist options
  • Save Nogbit/7462866 to your computer and use it in GitHub Desktop.
Save Nogbit/7462866 to your computer and use it in GitHub Desktop.
filter query works but not the compound index query?
#this query works
r.table("course").filter({
:Curriculum =>{
:Year => 2012,
:Quarter => "winter"
}
}).run.each do |i|
puts i
end
#the index gets created just fine
r.table("course").index_create("year_quarter") {|course|
[course["Curriculum"]["Year"], course["Curriculum"]["Quarter"]]
}.run
#this query returns nothing, trying to use the above index
r.table("course").get_all(2012, "winter", :index => "year_quarter")
.run.each do |i|
puts i
end
#data returned from the first query
{"id"=>"2012-DIS%20ST-winter-434", "MinimumTermCredit"=>5, "MaximumTermCredit"=>0, "MaximumCredit"=>0, "LastEffectiveTerm"=>{"Year"=>9999, "Quarter"=>"autumn", "Href"=>"/student/v4/public/term/9999,autumn.json"}, "GradingSystem"=>"credit/no credit or standard", "GeneralEducationRequirements"=>{"Writing"=>false, "VisualLiteraryAndPerformingArts"=>false, "QuantitativeAndSymbolicReasoning"=>false, "NaturalWorld"=>false, "IndividualsAndSocieties"=>true, "EnglishComposition"=>false}, "FirstEffectiveTerm"=>{"Year"=>2011, "Quarter"=>"winter", "Href"=>"/student/v4/public/term/2011,winter.json"}, "Curriculum"=>{"Year"=>2012, "Quarter"=>"winter", "Href"=>"/student/v4/public/curriculum/2012,winter,DIS%20ST.json", "CurriculumAbbreviation"=>"DIS ST"}, "CreditControl"=>"fixed credit", "CourseTitleLong"=>"CIVIL AND HUMAN RIGHTS LAW FOR DISABLED PEOPLE", "CourseTitle"=>"CIV/HUMN RGTS LAW", "CourseNumber"=>434, "CourseDescription"=>"Expands knowledge of civil and human rights for disabled people. Examines the American perspective (ADA) as well as various international models including the United Nations' International Human Rights treaties as they relate to disabled people. Recommended: LSJ 230/CHID 230/DIS ST 230. Offered: jointly with CHID 434/LSJ 434.", "CourseComment"=>"ADD JT STATUS", "CourseCollege"=>"Arts & Sciences", "CourseCampus"=>"Seattle"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment