{"id":23646983,"url":"https://github.com/supercaracal/lsolr","last_synced_at":"2025-08-31T22:32:20.141Z","repository":{"id":52295238,"uuid":"113540197","full_name":"supercaracal/lsolr","owner":"supercaracal","description":"Query builder for Apache Solr in Ruby","archived":false,"fork":false,"pushed_at":"2024-02-17T23:19:19.000Z","size":88,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-01T00:14:27.605Z","etag":null,"topics":["ruby","solr"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/lsolr","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/supercaracal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-12-08T06:29:57.000Z","updated_at":"2023-03-05T08:58:29.000Z","dependencies_parsed_at":"2024-02-18T00:24:23.283Z","dependency_job_id":"bb7c4e58-8396-48a1-b89a-f3945d72ee54","html_url":"https://github.com/supercaracal/lsolr","commit_stats":{"total_commits":107,"total_committers":3,"mean_commits":"35.666666666666664","dds":0.514018691588785,"last_synced_commit":"d2bad942caf83c2ce18b507c18dd334c4519e7d3"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercaracal%2Flsolr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercaracal%2Flsolr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercaracal%2Flsolr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercaracal%2Flsolr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supercaracal","download_url":"https://codeload.github.com/supercaracal/lsolr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231633143,"owners_count":18403402,"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":["ruby","solr"],"created_at":"2024-12-28T13:48:42.535Z","updated_at":"2024-12-28T13:48:42.980Z","avatar_url":"https://github.com/supercaracal.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"LSolr\n[![Gem Version](https://badge.fury.io/rb/lsolr.svg)](https://badge.fury.io/rb/lsolr)\n![Test Status](https://github.com/supercaracal/lsolr/workflows/Test/badge.svg?branch=master)\n![Release Status](https://github.com/supercaracal/lsolr/workflows/Release/badge.svg)\n=====================\nLSolr is a query builder for Apache Solr in Ruby.\nIt keeps one direction linked list internally.\n\n```\nterm = field:value = a LSolr instance\n\n     AND      AND      AND     AND\n     OR       OR       OR      OR\nterm \u003c-- term \u003c-- term \u003c-- ... \u003c-- term\n```\n\nIt supports only [standard query](https://lucene.apache.org/solr/guide/7_2/the-standard-query-parser.html).\nIt isn't a client for Apache Solr.\nIt has only features as a query builder.\nPlease use it with [RSolr](https://github.com/rsolr/rsolr).\n\n## Installation\n\n```\n$ gem install lsolr\n```\n\n## Example\n\n```ruby\nrequire 'lsolr'\n\nLSolr.build(field1: 'hoge', field2: true).to_s\n#=\u003e 'field1:hoge AND field2:true'\n```\n\n```ruby\nrequire 'lsolr'\n\nparams = {\n  field01: 'hoge',\n  field02: :fuga,\n  field03: 14,\n  field04: 7.3,\n  field05: true,\n  field06: false,\n  field07: Date.new(7000, 7, 1),\n  field08: DateTime.new(6000, 5, 31, 6, 31, 43),\n  field09: Time.new(5000, 6, 30, 12, 59, 3),\n  field10: LSolr.new(:field10).fuzzy_match('foo'),\n  field11: [1, 2, 3],\n  field12: 1..10,\n  field13: 20...40,\n  field14: Date.new(3000, 1, 1)..Date.new(4000, 12, 31),\n  field15: (3.0..4.0).step(0.1)\n}\n\nLSolr.build(params).to_s\n#=\u003e 'field01:hoge AND\n#    field02:fuga AND\n#    field03:14 AND\n#    field04:7.3 AND\n#    field05:true AND\n#    field06:false AND\n#    field07:\"7000-07-01T00:00:00Z\" AND\n#    field08:\"6000-05-31T06:31:43Z\" AND\n#    field09:\"5000-06-30T12:59:03Z\" AND\n#    field10:foo~2.0 AND\n#    field11:(1 2 3) AND\n#    field12:[1 TO 10] AND\n#    field13:[20 TO 40} AND\n#    field14:[3000-01-01T00:00:00Z TO 4000-12-31T00:00:00Z] AND\n#    field15:[3.0 TO 4.0]'\n```\n\n```ruby\nrequire 'lsolr'\n\nbool1 = LSolr.new(:bool_field).match(true)\nbool2 = LSolr.new(:bool_field).match(false)\ndate1 = LSolr.new(:date_field1)\n             .greater_than_or_equal_to('*')\n             .less_than_or_equal_to(Time.new(2000, 6, 30, 23, 59, 59))\ndate2 = LSolr.new(:date_field2)\n             .greater_than(Time.new(2000, 7, 1, 0, 0, 0))\n             .less_than(Time.new(2001, 1, 1, 0, 0, 0))\n\nleft = bool1.and(date1).and(date2).wrap\nright = bool2.and(date1.or(date2).wrap).wrap\n\nleft.or(right).to_s\n#=\u003e '(bool_field:true\n#      AND date_field1:[* TO 2000-06-30T23:59:59Z]\n#      AND date_field2:{2000-07-01T00:00:00Z TO 2001-01-01T00:00:00Z})\n#    OR\n#    (bool_field:false\n#      AND (date_field1:[* TO 2000-06-30T23:59:59Z]\n#        OR date_field2:{2000-07-01T00:00:00Z TO 2001-01-01T00:00:00Z}))'\n```\n\n```ruby\nrequire 'lsolr'\n\n%w[a b c].map { |v| LSolr.new(:field).prefix_match(\"#{v}*\") }\n         .reduce { |a, e| a.or(e) }\n         .wrap.not.to_s\n#=\u003e 'NOT (field:a* OR field:b* OR field:c*)'\n```\n\n```ruby\nrequire 'lsolr'\n\nLSolr.build('a:1').and(b: 2).to_s\n#=\u003e 'a:1 AND b:2'\n```\n\n## See also\n* [The Standard Query Parser](https://lucene.apache.org/solr/guide/7_2/the-standard-query-parser.html)\n* [RSolr](https://github.com/rsolr/rsolr)\n* [Ruby Doc](http://www.rubydoc.info/github/supercaracal/lsolr/LSolr)\n* [Gem Guide](http://guides.rubygems.org/make-your-own-gem/)\n\n## Motivation\nWe are trying to use this gem in a web service of our company.\nOur search component has complex features.\nSo we should implement as a polymorphic class each search parameters.\nWe think this gem fits in implementation like that.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupercaracal%2Flsolr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupercaracal%2Flsolr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupercaracal%2Flsolr/lists"}