Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/sf9v/solr-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/sf9v/solr-go

  • v0.3.4
  • Source
  • Go
  • Socket score

Version published
Created
Source

Solr-Go

Github Actions Coverage Status Go Report Card GoDoc

A Solr client for Go.

Installation

$ go get github.com/stevenferrer/solr-go

Example

import (
    "github.com/stevenferrer/solr-go"
)

...

// Create a client
baseURL := "http://solr.example.com"
client := solr.NewJSONClient(baseURL)

// Create a query
query := solr.NewQuery(solr.NewDisMaxQueryParser().
        Query("'solr rocks'").BuildParser()).
    Queries(solr.M{
        "query_filters": []solr.M{
            {
                "#size_tag": solr.M{
                    "field": solr.M{
                        "f":     "size",
                        "query": "XL",
                    },
                },
            },
            {
                "#color_tag": solr.M{
                    "field": solr.M{
                        "f":     "color",
                        "query": "Red",
                    },
                },
            },
        },
    }).
    Facets(
        solr.NewTermsFacet("categories").
            Field("cat").Limit(10),
        solr.NewQueryFacet("high_popularity").
            Query("popularity:[8 TO 10]"),
    ).
    Sort("score").
    Offset(1).
    Limit(10).
    Filters("inStock:true").
    Fields("name", "price")

// Send the query
queryResponse, err := client.Query(context.Background(), "techproducts", query)

See integration test for a more complete example.

Supported APIs

Other features

  • Basic auth support - Interacting with a Solr server that uses the basic authentication plugin.

Projects using it

A (minor) word of caution

Keep in mind that this library is still evolving and will likely have some breaking changes until v1.0. We will try our best to keep the breaking changes minimal.

Supporting the project

You can support the project in the following ways:

  • Give it a star, it's free!
  • Write some tutorials
  • Use it your projects

Contributing

Please feel free to improve this project by opening an issue or by making a pull-request.

License

MIT

FAQs

Package last updated on 08 May 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc