{"id":17119191,"url":"https://github.com/regadas/sunspot","last_synced_at":"2025-03-24T02:19:30.709Z","repository":{"id":1415559,"uuid":"1501054","full_name":"regadas/sunspot","owner":"regadas","description":"Sunspot JRuby","archived":false,"fork":false,"pushed_at":"2011-03-20T11:10:14.000Z","size":15128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T08:24:15.283Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/regadas.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-03-19T20:17:09.000Z","updated_at":"2014-06-13T20:28:58.000Z","dependencies_parsed_at":"2022-07-07T12:00:52.334Z","dependency_job_id":null,"html_url":"https://github.com/regadas/sunspot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regadas%2Fsunspot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regadas%2Fsunspot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regadas%2Fsunspot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regadas%2Fsunspot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/regadas","download_url":"https://codeload.github.com/regadas/sunspot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245195962,"owners_count":20575938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T17:56:29.415Z","updated_at":"2025-03-24T02:19:30.691Z","avatar_url":"https://github.com/regadas.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Sunspot\n\nhttp://outoftime.github.com/sunspot\n\nSunspot is a Ruby library for expressive, powerful interaction with the Solr\nsearch engine. Sunspot is built on top of the RSolr library, which\nprovides a low-level interface for Solr interaction; Sunspot provides a simple,\nintuitive, expressive DSL backed by powerful features for indexing objects and\nsearching for them.\n\nSunspot is designed to be easily plugged in to any ORM, or even non-database-backed\nobjects such as the filesystem.\n\n=== Where to learn all about Sunspot: The Wiki!\n\nNew to Sunspot and using Rails? Check out {Adding Sunspot search to Rails in 5\nminutes or less}[http://wiki.github.com/outoftime/sunspot/adding-sunspot-search-to-rails-in-5-minutes-or-less].\n\nThis README is intended as a quick primer on what Sunspot is capable of; for\ndetailed treatment of Sunspot's full feature range, check out the wiki:\nhttp://wiki.github.com/outoftime/sunspot\n\nThe API documentation is also complete and up-to-date; however, because of the\nway Sunspot is structured, it's not the easiest way for new users to get to know\nthe library.\n\n=== Features:\n\n* Define indexing strategy for each searchable class using intuitive block-based\n  API\n* Clean separation between keyword-searchable fields and fields for\n  scoping/ordering\n* Define fields based on existing attributes or \"virtual fields\" for custom\n  indexing\n* Indexes each object's entire superclass hierarchy, for easy searching for all\n  objects inheriting from a parent class\n* Intuitive DSL for scoping searches, with all the usual boolean operators\n  available\n* Intuitive interface for requesting facets on indexed fields\n* Extensible adapter architecture for easy integration of other ORMs or\n  non-model classes\n* Refine search using field facets, date range facets, or ultra-powerful\n  query facets\n* Full compatibility with will_paginate\n* Ordering by field value, relevance, geographical distance, or random\n\n== Installation\n\n  gem install sunspot\n\nIn order to start the packaged Solr installation, run:\n\n  sunspot-solr start -- [-d /path/to/data/directory] [-p port] [-s path/to/solr/home] [--pid-dir=path/to/pid/dir]\n\nIf you don't specify a data directory, your Solr index will be stored in your\noperating system's temporary directory.\n\nIf you specify a solr home, the directory must contain a \u003ccode\u003econf\u003c/code\u003e\ndirectory, which should contain at least \u003ccode\u003eschema.xml\u003c/code\u003e and\n\u003ccode\u003esolrconfig.xml\u003c/code\u003e. Be sure to copy the \u003ccode\u003eschema.xml\u003c/code\u003e out of\nthe Sunspot gem's \u003ccode\u003esolr/solr/conf\u003c/code\u003e directory. Sunspot relies on the\nfield name patterns defined in the packaged \u003ccode\u003eschema.xml\u003c/code\u003e, so those\ncannot be modified.\n\nYou can also run your own instance of Solr wherever you'd like; just copy the solr/config/schema.xml file out of the gem's solr into your installation.\nYou can change the URL at which Sunspot accesses Solr by setting \u003ccode\u003eSOLR_URL\u003c/code\u003e in your application's environment, or assigning it to Sunspot's configuration directly:\n\n  Sunspot.config.solr.url = 'http://solr.my.host:9818/solr'\n\n== Rails Integration\n\nThe Sunspot::Rails plugin makes integrating Sunspot into Rails drop-in easy.\n\n    gem install sunspot_rails\n\nSee the README for that gem or the Sunspot Wiki for more information.\n\n== Using Sunspot\n\n=== Define an index:\n\n  class Post\n    #...\n  end\n\n  Sunspot.setup(Post) do\n    text :title, :description, :stored =\u003e true\n    string :author_name\n    integer :blog_id\n    integer :category_ids\n    float :average_rating, :using =\u003e :ratings_average\n    time :published_at\n    string :sort_title do\n      title.downcase.sub(/^(an?|the)\\W+/, ''/) if title = self.title\n    end\n  end\n\nSee Sunspot.setup for more information.\n\nNote that in order for a class to be searchable, it must have an adapter\nregistered for itself or one of its subclasses. Adapters allow Sunspot to load\nobjects out of persistent storage, and to determine their primary key for\nindexing. {Sunspot::Rails}[http://github.com/outoftime/sunspot_rails] comes with\nan adapter for ActiveRecord objects, but for other types of models you will need\nto define your own. See Sunspot::Adapters for more information.\n\n=== Search for objects:\n  \n  @search = Sunspot.search Post do\n    keywords 'great pizza' do \n      highlight :title, :description\n    end\n    with :author_name, 'Mark Twain'\n    with(:blog_id).any_of [2, 14]\n    with(:category_ids).all_of [4, 10]\n    with(:published_at).less_than Time.now\n    any_of do\n      with(:expired_at).greater_than(Time.now)\n      with(:expired_at, nil)\n    end\n    without :title, 'Bad Title'\n    without bad_instance # specifically exclude this instance from results\n\n    paginate :page =\u003e 3, :per_page =\u003e 15\n    order_by :average_rating, :desc\n\n    facet :blog_id\n  end\n\nSee Sunspot.search for more information.\n\n=== Work with search results (Haml for readability):\n\n  .facets\n    ul.blog_facet\n      - @search.facet(:blog_id).rows.each do |row|\n        li.facet_row\n          = link_to(row.instance.name, params.merge(:blog_id =\u003e row.value))\n          %span.count== (#{row.count})\n  .page_info== Displaying page #{@search.hits.page} of #{@search.hits.per_page} out of #{@search.total} results\n  - @search.each_hit_with_result do |hit, post|\n    .search_result\n      %h3.title\n        = link_to(h(hit.stored(:title)), post_url(post))\n      - if hit.score\n        %span.relevance== (#{hit.score})\n      %p= hit.highlight(:description).format { |word| \"\u003cspan class=\\\"highlight\\\"\u003e#{word}\u003c/span\u003e\" }\n  .pagination= will_paginate(@search.hits)\n\n== About the API documentation\n\nAll of the methods documented in the RDoc are considered part of Sunspot's\npublic API. Methods that are not part of the public API are documented in the\ncode, but excluded from the RDoc. If you find yourself needing to access methods\nthat are not part of the public API in order to do what you need, please contact\nme so I can rectify the situation!\n\n== Dependencies\n\n1. RSolr\n2. Java 1.5+\n\nSunspot has been tested with MRI 1.8.6 and 1.8.7, REE 1.8.6, YARV 1.9.1, and\nJRuby 1.6.0. \n\nNote: JRuby must have 1.9 option enabled.\n\n    export JRUBY_OPTS=--1.9 sunspot-solr start\n\n== Bugs\n\nPlease submit bug reports to\nhttp://outoftime.lighthouseapp.com/projects/20339-sunspot\n\n== Contribution Guidelines\n\nContributions are very welcome - both new features, enhancements, and bug fixes.\nBug reports with a failing regression test are also lovely. In order to keep the\ncontribution process as organized and smooth as possible, please follow these\nguidelines:\n\n* Contributions should be submitted via Sunspot's Lighthouse account, with an\n  attached git patch. See below for how to create a git patch.\n* Patches should not make any changes to the gemspec task other than\n  adding/removing dependencies (e.g., changing the name, version, email,\n  description, etc.)\n* Patches should not include any changes to the gemspec itself.\n* Document any new methods, options, arguments, etc.\n* Write tests.\n* As much as possible, follow the coding and testing styles you see in existing\n  code. One could accuse me of being nitpicky about this, but consistent code is\n  easier to read, maintain, and enhance.\n* Don't make any massive changes to the structure of library or test code. If\n  you think something needs a huge refactor or rearrangement, shoot me a\n  message; trying to apply that kind of patch without warning opens the door to\n  a world of conflict hurt.\n\nHere's how to create a Git patch - assuming you're pulling from the canonical\nSunspot repository at `upstream`:\n\n  git fetch upstream\n  git format-patch --stdout upstream/master.. \u003e my-awesome.patch\n\n== Help and Support\n\n=== Ask for help\n\n* Sunspot Discussion: {ruby-sunspot@googlegroups.com}[mailto:ruby-sunspot@googlegroups.com] / http://groups.google.com/group/ruby-sunspot\n* IRC: {#sunspot-ruby @ Freenode}[irc://chat.freenode.net/#sunspot-ruby]\n\n=== Tutorials and Articles\n\n* {Full Text Searching with Solr and Sunspot}[http://collectiveidea.com/blog/archives/2011/03/08/full-text-searching-with-solr-and-sunspot/] (Collective Idea)\n* {Full-text search in Rails with Sunspot}[http://tech.favoritemedium.com/2010/01/full-text-search-in-rails-with-sunspot.html] (Tropical Software Observations)\n* {Sunspot Full-text Search for Rails/Ruby}[http://therailworld.com/posts/23-Sunspot-Full-text-Search-for-Rails-Ruby] (The Rail World)\n* {A Few Sunspot Tips}[http://blog.trydionel.com/2009/11/19/a-few-sunspot-tips/] (spiral_code)\n* {Sunspot: A Solr-Powered Search Engine for Ruby}[http://www.linux-mag.com/id/7341] (Linux Magazine)\n* {Sunspot Showed Me the Light}[http://bennyfreshness.com/2010/05/sunspot-helped-me-see-the-light/] (ben koonse)\n* {How to Implement Spatial Search with Sunspot and Solr}[http://codequest.eu/articles/how-to-implement-spatial-search-with-sunspot-and-solr] (Code Quest)\n* {Sunspot 1.2 with Spatial Solr Plugin 2.0}[http://joelmats.wordpress.com/2011/02/23/getting-sunspot-1-2-with-spatial-solr-plugin-2-0-to-work/] (joelmats)\n* {rails3 + heroku + sunspot : madness}[http://anhaminha.tumblr.com/post/632682537/rails3-heroku-sunspot-madness] (anhaminha)\n* {How to get full text search working with Sunspot}[http://cookbook.hobocentral.net/recipes/57-how-to-get-full-text-search] (Hobo Cookbook)\n* {Full text search with Sunspot in Rails}[http://hemju.com/2011/01/04/full-text-search-with-sunspot-in-rail/] (hemju)\n* {Using Sunspot for Free-Text Search with Redis}[http://masonoise.wordpress.com/2010/02/06/using-sunspot-for-free-text-search-with-redis/] (While I Pondered...)\n* {Fuzzy searching in SOLR with Sunspot}[http://www.pipetodevnull.com/past/2010/8/5/fuzzy_searching_in_solr_with_sunspot/] (pipe :to =\u003e /dev/null)\n* {Default scope with Sunspot}[http://www.cloudspace.com/blog/2010/01/15/default-scope-with-sunspot/] (Cloudspace)\n* {Chef recipe for Sunspot in production}[http://gist.github.com/336403]\n* {Cucumber and Sunspot}[http://opensoul.org/2010/4/7/cucumber-and-sunspot] (opensoul.org)\n* {Testing Sunspot with Cucumber}[http://blog.trydionel.com/2010/02/06/testing-sunspot-with-cucumber/] (spiral_code)\n* {Running cucumber features with sunspot_rails}[http://blog.kabisa.nl/2010/02/03/running-cucumber-features-with-sunspot_rails] (Kabisa Blog)\n* {Testing Sunspot with Test::Unit}[http://timcowlishaw.co.uk/post/3179661158/testing-sunspot-with-test-unit] (Type Slowly)\n* {How To Use Twitter Lists to Determine Influence}[http://www.untitledstartup.com/2010/01/how-to-use-twitter-lists-to-determine-influence/] (Untitled Startup)\n* {Sunspot Quickstart}[http://wiki.websolr.com/index.php/Sunspot_Quickstart] (WebSolr)\n* {Solr, and Sunspot}[http://www.kuahyeow.com/2009/08/solr-and-sunspot.html] (YT!)\n* {The Saga of the Switch}[http://mrb.github.com/2010/04/08/the-saga-of-the-switch.html] (mrb -- includes comparison of Sunspot and Ultrasphinx)\n\n== Contributors\n\n* Mat Brown (mat@patch.com)\n* Peer Allan (peer.allan@gmail.com)\n* Dmitriy Dzema (dima@dzema.name)\n* Benjamin Krause (bk@benjaminkrause.com)\n* Marcel de Graaf (marcel@slashdev.nl)\n* Brandon Keepers (brandon@opensoul.org)\n* Peter Berkenbosch (peterberkenbosch@me.com)\n* Brian Atkinson\n* Tom Coleman (tom@thesnail.org)\n* Matt Mitchell (goodieboy@gmail.com)\n* Nathan Beyer (nbeyer@gmail.com)\n* Kieran Topping\n* Nicolas Braem (nicolas.braem@gmail.com)\n* Jeremy Ashkenas (jashkenas@gmail.com)\n* Dylan Vaughn (dylanvaughn@yahoo.com)\n* Brian Durand (brian@embellishedvisions.com)\n* Sam Granieri (sam@samgranieri.com)\n* Nick Zadrozny (nick@onemorecloud.com)\n* Jason Ronallo (jronallo@gmail.com)\n\n== License\n\nSunspot is distributed under the MIT License, copyright (c) 2008-2009 Mat Brown\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregadas%2Fsunspot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fregadas%2Fsunspot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregadas%2Fsunspot/lists"}