{"id":17405063,"url":"https://github.com/jongpie/nebulaqueryandsearch","last_synced_at":"2026-02-14T19:02:01.491Z","repository":{"id":34634890,"uuid":"38585852","full_name":"jongpie/NebulaQueryAndSearch","owner":"jongpie","description":"Apex library that dynamically generates SOQL \u0026 SOSL queries","archived":false,"fork":false,"pushed_at":"2026-02-07T23:05:37.000Z","size":143999,"stargazers_count":43,"open_issues_count":12,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-08T07:54:19.686Z","etag":null,"topics":["apex","fluent-api","forcedotcom","salesforce","salesforce-developers","soql","soql-query","sosl","sosl-search"],"latest_commit_sha":null,"homepage":"","language":"Apex","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/jongpie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-07-05T22:05:22.000Z","updated_at":"2024-04-16T21:22:44.000Z","dependencies_parsed_at":"2024-02-21T00:52:36.729Z","dependency_job_id":"33d0a799-9d94-4c3b-ba45-d1cd056566ab","html_url":"https://github.com/jongpie/NebulaQueryAndSearch","commit_stats":{"total_commits":54,"total_committers":4,"mean_commits":13.5,"dds":"0.16666666666666663","last_synced_commit":"269a787b8d51c419757df7e1558a447eba7938f8"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/jongpie/NebulaQueryAndSearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FNebulaQueryAndSearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FNebulaQueryAndSearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FNebulaQueryAndSearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FNebulaQueryAndSearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jongpie","download_url":"https://codeload.github.com/jongpie/NebulaQueryAndSearch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongpie%2FNebulaQueryAndSearch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29452587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["apex","fluent-api","forcedotcom","salesforce","salesforce-developers","soql","soql-query","sosl","sosl-search"],"created_at":"2024-10-16T20:22:50.551Z","updated_at":"2026-02-14T19:02:01.473Z","avatar_url":"https://github.com/jongpie.png","language":"Apex","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nebula Query \u0026 Search for Salesforce Apex\n\nA dynamic SOQL query \u0026 SOSL search library for Salesforce Apex\n\n## Unlocked Package - no namespace - v3.1.2\n\n[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsbQQAS)\n[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsbQQAS)\n\nInstall with SF CLI:\n\n```shell\nsf package install --apex-compile package --wait 20 --security-type AdminsOnly --package 04t5Y000001TsbQQAS\n```\n\nInstall with SFDX CLI:\n\n```shell\nsfdx force:package:install --apexcompile package --wait 20 --securitytype AdminsOnly --package 04t5Y000001TsbQQAS\n```\n\n## Unlocked Package - `Nebula` namespace - v3.1.2\n\n[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsbVQAS)\n[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsbVQAS)\n\nInstall with SF CLI:\n\n```shell\nsf package install --apex-compile package --wait 20 --security-type AdminsOnly --package 04t5Y000001TsbVQAS\n```\n\nInstall with SFDX CLI:\n\n```shell\nsfdx force:package:install --apexcompile package --wait 20 --securitytype AdminsOnly --package 04t5Y000001TsbVQAS\n```\n\n## Features\n\n- Provides chainable builder methods for dyanmically building SOQL queries \u0026 SOSL searches in Apex\n- Easily add fields to a query based on field level security\n- Easily add fields from a field set\n- Automatically adds the parent name field for any lookup/master-detail fields\n- Adds translations for picklist fields \u0026 record types by calling includeLabels()\n- Adds localized formatting for number, date, datetime, time, or currency fields by calling includeFormattedValues()\n- Leverage query scope to filter results\n- Enable query \u0026 search caching by simple calling cacheResults()\n- Reuse your dynamic SOQL queries to quickly build dynamic SOSL searches\n\n## Overview\n\nThere are 3 main builder classes\n\n| \u0026nbsp;      | Query                        | AggregateQuery                               | RecordSearch                                        |\n| ----------- | ---------------------------- | -------------------------------------------- | --------------------------------------------------- |\n| Super Class | SOQL.cls (Queries)           | SOQL.cls (Queries)                           | SOSL.cls (Searches)                                 |\n| Action      | Queries an SObject           | Queries an SObject                           | Searches 1 or more SObjects                         |\n| Returns     | `SObject` or `List\u003cSObject\u003e` | `AggregateResult` or `List\u003cAggregateResult\u003e` | `SObject`, `List\u003cSObject\u003e` or `List\u003cList\u003cSObject\u003e\u003e` |\n\n## SOQL SObject Query Examples\n\n**Basic Usage:** Query an object \u0026 return the object's ID and display name field (typically the 'Name' field, but some objects use other fields, like Task.Subject and Case.CaseNumber). Since no filters have been added, this query would also return all accounts.\n\n```\nList\u003cAccount\u003e accounts = new Query(Schema.Account.SObjectType).getResults();\n```\n\n**Advanced Usage:** Query an object \u0026 leverage the query builder methods. The order of the builder methods does not matter - you can arrange the calls to these methods in any order that you prefer.\n\n```\nQuery accountQuery = new Query(Schema.Account.SObjectType) // Query the account object\n    .addField(Schema.Account.ParentId)                                                 // Include the ParentId field, using SObjectField. The current user must have at least read access to the field\n    .addField(Schema.Account.Type, SOQL.FieldCategory.UPDATEABLE)                      // Include the Type field if the current user has access to update it\n    .addFields(SOQL.FieldCategory.CUSTOM)                                              // Include all custom fields - only fields that are accessible to the user are included\n    .addFieldSet(Schema.Account.MyFieldSet)                                            // Include all fields in a field set that are accessible to the user\n    .removeField(Schema.Account.My_Custom_Field__c)                                    // remove a custom field\n    .usingScope(SOQL.Scope.MINE)                                                       // Set the query scope\n    .filterWhere(Schema.Account.CreatedDate, '=', new SOQL.DateLiteral('LAST_WEEK'))   // Filter on the created date, using a date literal\n    .orderBy(Schema.Account.Type)                                                      // Order by a field API name - sort order/nulls defaults to 'Type ASC NULLS FIRST'\n    .orderBy(Account.Name, SOQL.SortOrder.ASCENDING)                                   // Order by, using SObjectField \u0026 sort order\n    .orderBy(Account.AnnualRevenue, SOQL.SortOrder.DESCENDING, false)                  // Order by, using SObjectField, sort order and nulls sort order\n    .limitTo(100)                                                                      // Limit the results to 100 records\n    .includeLabels()                                                                   // Include labels/translations for any picklist fields or record types. These are aliased using the convention 'FieldName__c_Label'\n    .includeFormattedValues()                                                          // Include formatted values for any number, date, time, or currency fields\n    .cacheResults()                                                                    // When enabled, the query results are internally cached - any subsequent calls for getResults() will returned cached results instead of executing the query again\n    .offsetBy(25);                                                                     // Skip the first 25 results\n\n// Execute the query and store the results in the 'accounts' variable\nList\u003cAccount\u003e accounts = accountQuery.getResults();\n\n/****** Resulting output *******\nSELECT Id, MyCustomDateField__c, MyCustomPicklistField__c, Name,\n    format(MyCustomDateField__c) MyCustomDateField__c__Formatted,\n    toLabel(MyCustomPicklistField__c) MyCustomPicklistField__c__Label\nFROM Account\nUSING SCOPE MINE\nWHERE CreatedDate = LAST_WEEK\nORDER BY Type ASC NULLS FIRST, Name ASC NULLS FIRST, AnnualRevenue DESC NULLS LAST LIMIT 100 OFFSET 25\n*******************************/\n\nSystem.debug(accountQuery.getQuery());\n```\n\n## SOSL Search Examples\n\n**Basic Usage:** Search a single object\n\n```java\nQuery userQuery = new Query(Schema.User.SObjectType); // Create an instance of Query for an SObject - you can include additional fields, filters, etc\nRecordSearch userSearch      = new RecordSearch('my search term', userQuery);   // Create a new RecordSearch instance with a search term \u0026 instance of Query\nList\u003cUser\u003e userSearchResults  = userSearch.getFirstResults();                     // RecordSearch returns a list of lists of sobjects - getFirstResults() returns the first list\n\n/****** Resulting output *******\nFIND 'my search term' IN ALL FIELDS RETURNING User(Id, Name)\n*******************************/\n\nSystem.debug(userSearch.getSearch());\n```\n\n**Advanced Usage:** Search several objects\n\n```java\nQuery accountQuery  = new Query(Schema.Account.SObjectType);                  // Create an instance of Query for the Account object\nQuery contactQuery  = new Query(Schema.Contact.SObjectType);                  // Create an instance of Query for the Contact object\nQuery leadQuery     = new Query(Schema.Lead.SObjectType);                     // Create an instance of Query for the Lead object\nList\u003cQuery\u003e queries = new List\u003cQuery\u003e{contactQuery, accountQuery, leadQuery}; // Add the Query queries to a list\n\nRecordSearch mySearch            = new RecordSearch('my search term', queries); // Create a new RecordSearch instance with a search term \u0026 the list of Query queries\nList\u003cList\u003cSObject\u003e\u003e searchResults = mySearch.getResults();                        // Returns all search results\n\n/****** Resulting output *******\nFIND 'my search term' IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, Name), Lead(Id, Name)\n*******************************/\n\nSystem.debug(mySearch.getSearch());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongpie%2Fnebulaqueryandsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjongpie%2Fnebulaqueryandsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongpie%2Fnebulaqueryandsearch/lists"}