{"id":13735064,"url":"https://github.com/front/solstice","last_synced_at":"2025-10-22T11:47:32.211Z","repository":{"id":12150918,"uuid":"14744491","full_name":"front/solstice","owner":"front","description":"A simple Solr wrapper for AngularJS apps","archived":true,"fork":false,"pushed_at":"2017-11-09T12:30:28.000Z","size":23,"stargazers_count":36,"open_issues_count":1,"forks_count":7,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-11-07T22:13:30.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/front.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-27T10:56:12.000Z","updated_at":"2024-06-19T07:12:37.000Z","dependencies_parsed_at":"2022-09-23T04:32:37.942Z","dependency_job_id":null,"html_url":"https://github.com/front/solstice","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/front%2Fsolstice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/front%2Fsolstice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/front%2Fsolstice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/front%2Fsolstice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/front","download_url":"https://codeload.github.com/front/solstice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224727173,"owners_count":17359532,"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-08-03T03:01:02.674Z","updated_at":"2025-10-22T11:47:26.893Z","avatar_url":"https://github.com/front.png","language":"JavaScript","funding_links":[],"categories":["Interfaces"],"sub_categories":[],"readme":"Solstice\n========\nA simple Solr wrapper for AngularJS (1.x) apps\n\nSolstice is an AngularJS module, developed by [Frontkom](http://www.frontkom.no/), that enables simple querying of Solr indexes.\nSolstice provides a search **service** and a companion **directive** that can be used in any Angularjs project.\n\nSolstice is inspired by [Restangular](https://github.com/mgonto/restangular) - an Angularjs service to handle Rest API resources.\n\n### Installation\nSolstice can be installed using **Bower** or manually.\n\n#### Using bower\n```\nbower install solstice\n```\n\n\n#### Manually\nClone or download this repository and add the **dist/solstice.js** or **dist/solstice.min.js** file to your html.\n\n```\n  \u003cscript type=\"text/javascript\" src=\".../dist/solstice.js\"\u003e\u003c/script\u003e\n\n```\n\n\n### Configuration\n\nTo use Solstice, just add it as a dependency to your app and set the default Solr index url in the config function.\n\n```\nvar app = angular.module('my-app', ['solstice']);\n\napp.config(function(SolsticeProvider) {\n  SolsticeProvider.setEndpoint('url-to-your-index');\n});\n\n```\n\n\n###Using Solstice\n\n\n#### As service:\nTo use Solstice, you just need to add it as a dependency to the controller function.\n\n```\napp.controller('MyController', function($scope, Solstice) {\n  Solstice.search({\n      q: 'bundle:article AND status:true',\n      fl: 'title, teaser, published',\n      sort: 'published desc',\n      rows: 10\n  })\n  .then(function (_){\n    var data = _.data.response;\n    $scope.results = data.docs;\n    console.log(data.docs);\n  });\n});\n```\n\n##### Using a Diferent endpoint\n\nFor some queries you may need to use a different index than the global one. In that case, you need to create a new service that extends Solstice.\n\nIn the following example, we create a new service called **Equinox** that uses a different Solr index.\n\n```\napp.provider('Equinox', function(Solstice) {\n  return Solstice.withEndpoint('a-diferent-solr-index-url');\n});\n\napp.controller('AnotherController', function($scope, Equinox) {\n  Equinox.search({\n      q: '*',\n      fl: 'title, teaser, published'\n      rows: 2\n  })\n  .then(function (_){\n    var data = _.data.response;\n    $scope.results = data.docs;\n    console.log(data.docs);\n  });\n});\n```\n\n\n####Usage as directive:\nSolstice can also be used directly as a directive, if the use of the service is not required. This can be particularly usefull if the Solr querying is just a small part of a larger project.\n\nTo use it, just add the directive `solr-search` to any element in the html. This directive provides the following options:\n\n- `index-url`: The Solr index to be used. Only required if it wasn't set in the config.\n- `q`: The query string. See the Apache solr [documentation](http://wiki.apache.org/solr/SolrQuerySyntax) for details.\n- `rows`: The number of results to retrieve.\n- `start`: The number of results to skip.\n- `sort`: The sort params.\n- `fl`: The field list to be retrieved.\n\n```\n\u003cany-tag solr-search index-url=\"your-index-url\" start=\"0\" rows=\"20\"  \u003e\n  \u003cheader\u003e\n    \u003cp\u003eFound {{ solr.found }} results.\u003c/p\u003e\n  \u003c/header\u003e\n  \u003cul\u003e\n    \u003cli ng-repeat=\"item in solr.results\"\u003e{{ item.title }}\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/any-tag\u003e\n```\nThe module provides the $scope with a `solr` object. It has the following properties:\n\n- `results`: the list of results\n- `found`: the total number of results found.\n\n\n##Future Features\n\n- Full caching with Angularjs cacheFactory\n- Support more SOLR features\n- Querystring parsing\n- Query language support\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffront%2Fsolstice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffront%2Fsolstice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffront%2Fsolstice/lists"}