github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

matthewrudy / solr_query

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 10
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

a ruby library designed to make building nested Solr queries simple and standardized. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Merge branch 'master' of git@github.com:matthewrudy/solr_query 
Matthew Rudy Jacobs (author)
Fri Feb 13 05:47:52 -0800 2009
commit  49fd3f135bd3baffa141f8bec032ccb45544eee9
tree    cd987549df0611602451d6487fd46c3b19ccfa17
parent  8fd5d9538823ffdc9f8b10af4524943c88c6b53e parent  7f891ebf865461889f372d5c1ffeedbeb4151f3e
solr_query /
name age
history
message
file MIT-LICENSE Mon Nov 17 06:18:15 -0800 2008 SolrQuery plugin [Matthew Rudy Jacobs]
file README Mon Nov 17 13:28:11 -0800 2008 [matthewrudy]
file Rakefile Mon Nov 17 06:18:15 -0800 2008 SolrQuery plugin [Matthew Rudy Jacobs]
directory lib/ Loading commit data...
directory spec/ Mon Nov 17 06:49:33 -0800 2008 A spec to ensure our keyword.blank? code works [Matthew Rudy Jacobs]
README
SolrQuery
=========

SolrQuery is a ruby library designed to make building nested Solr queries simple and standardized.

It does everything for you,
it deals with escaping characters,
matching ActiveRecord objects by id.

It'll take an array of strings,
an array of ActiveRecords.

Give it a Hash or a Range, and it'll sort out lucene range queries for you!

Example
=======

build a query for solr;

  SolrQuery.build(:keyword => "Feather duster")
  #=> "feather duster"

  SolrQuery.build(:keyword => "clean", :organisation => [organisation1, organisation2])
  #=> "clean AND organisation:(275 OR 6534)"

  SolrQuery.build(:colour => ["red", "pink"], :item_type => ["Toy", "Train"])
  #=> "colour:(red OR pink) AND item_type:(Toy OR Train)"

or you can specify a different magical key for keyword;

  SolrQuery.build({:keyword => "old one", :new_keyword => "new one"}, :new_keyword)
  #=> "new one AND keyword:(old one)"

if you need to do range queries;

  SolrQuery.build(:salary => {:min => "010000", :max => "050000"})
  #=> "salary:([010000 TO 050000])"

  SolrQuery.build(:salary => "010000".."050000")
  #=> "salary:([010000 TO 050000])"

  SolrQuery.build(:surname => {:min => "jacobs")
  #=> "surname:([jacobs TO *])"


Copyright (c) 2008 [Matthew Rudy Jacobs], released under the MIT license
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server