
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
github.com/hectorcorrea/solr
A Solr client written in Go.
This client is geared towards supporting a web user interface that queries and filters via facets. This package provides a lot of the functionality to know what facets the user is filtering on and allow the user interface to add and remove more facets to the existing search.
Project https://github.com/hectorcorrea/solrdora is an example of a complete web application using this package.
solr.go
: the main entry point, functions Get()
and Search()
are defined here.getParams.go
: parameter for the Get()
function.searchParams.go
: parameter for the Search()
function.searchResponse.go
: the object used to represent the results of a Search()
filterQueries.go
: represent the fq
values passed to Solr.document.go
: represents a document retrieved from Solr via Search()
or Get()
.Search for documents
q := "title:\"one two three\""
solr := solr.New("http://localhost:8983/solr/your-core")
results, err := solr.SearchText(q)
log.Printf("Documents found: %d", results.NumFound)
for i, doc := range results.Documents {
log.Printf("%d %v", i, doc)
}
Get one Solr document by ID
q := "id:123"
fl := []string{}
options := map[string]string{}
params := NewGetParams(q, fl, options)
solr := solr.New("http://localhost:8983/solr/your-core")
doc, err := solr.Get(params)
log.Printf("%v", doc)
Search for documents customizing list of fields to retrieve, facets, and other parameters.
# In a web app qs will be req.URL.Query() where req is
# the *http.Request that you get in your HTTP handler.
qs := url.Values{
"q": []string{"title:\"one two\""},
"fq": []string{"subject|Geography"},
}
options := map[string]string{
"defType": "edismax",
}
facets := map[string]string{
"publisher": "Publisher name",
"subject_str": "Subject",
}
params := NewSearchParamsFromQs(qs, options, facets)
params.Fl = []string{"id", "title", "authorsAll", "_version_"}
solr := solr.New("http://localhost:8983/solr/your-core")
results, err := solr.Search(params)
log.Printf("Documents found: %d", results.NumFound)
for i, doc := range results.Documents {
log.Printf("%d %v", i, doc)
}
A full-blow example using this library can be found in the SolrDora repo.
The GoDoc documentation for this package can be found here
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.