Giter VIP home page Giter VIP logo

solrnet's Introduction

SolrNet is an Apache Solr and SolrCloud client for .NET

SolrNet does not attempt to abstract much over Solr, it's assumed that you know what Solr is and how to use it, just as you need to know relational databases before using an ORM.

If you're not familiar with Solr, take your time to follow the Solr tutorial, see the FAQ and the docs. Consider getting a book.

Downloads

The easiest way to get going is to use our NuGet packages:

Solr

Package Description .NET Framework .NET Standard
SolrNet.Core Core library, best used with one of the DI integration packages 4.6 2.0
SolrNet Lightweight DI - commonservicelocator 4.6 2.0
SolrNet.Windsor Castle Windsor integration 4.6 2.0
SolrNet.Microsoft.DependencyInjection Microsoft Core Dependency Injection 4.6.1 2.0
SolrNet.StructureMap StructureMap 4.6 2.0
SolrNet.Ninject Ninject 4.6 2.0
SolrNet.Unity Unity 4.6 2.0
SolrNet.Autofac Autofac 4.6 2.0
SolrNet.SimpleInjector SimpleInjector 4.6 2.0

SolrCloud

Package Description .NET Framework .NET Standard
SolrNet.Cloud.Core Core library, best used with one of the DI integration packages 4.6 2.0
SolrNet.Cloud Lightweight DI - commonservicelocator 4.6 2.0
SolrNet.Cloud.Unity Unity 4.6 2.0
SolrNet.Cloud.Autofac Autofac 4.6 2.0

Documentation index

Contributing

See Contributing

Release notes

See Change Log

solrnet's People

Contributors

adamkirkton avatar ahazelwood avatar alexeykozhemiakin avatar almosttoocool avatar ariasjose avatar bkrbkr avatar de10101 avatar earloc avatar endforward avatar fatmuis avatar fleetstar avatar gareththackeray avatar gjunge avatar jerizm avatar jevgenigeurtsen avatar jokin avatar maciej-rubrikkgroup avatar markunsworth avatar mattoscln avatar mausch avatar paigecook avatar parkerbeck avatar ptasz3k avatar ragerabbit avatar richtea avatar serbrech avatar tspayne87 avatar xmorera avatar yorah avatar zzapal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solrnet's Issues

how to log raw queries with windsor integration?

I was wondering how i could log all raw queries (debug) with windsor integration. When i want to debug the "LoggingConnection" class, it is not stopping on my breakingpoints. This is what i have:

Windsor implementation:

        var windsorContainer = new WindsorContainer();
        var solrNetFacility = new SolrNetFacility(solrUrl);
        var coreId = "store-" + storeId;

        windsorContainer.Register(Component.For<ISolrConnection>()
            .ImplementedBy<LoggingConnection>()
            .DependsOn(Property.ForKey("serverURL").Eq(solrUrl)));

        solrNetFacility.AddCore(coreId, typeof(SolrProduct), solrUrl);
        windsorContainer.AddFacility("solr", solrNetFacility);

        var solr = windsorContainer.Resolve<ISolrOperations<SolrProduct>>(coreId);

        ...... do stuff

Class like the example (logging):

public class LoggingConnection : ISolrConnection
{
    private readonly ISolrConnection _solrConnection;
    private static readonly ILog _log = LogManager.GetLogger(typeof(LoggingConnection));

    public LoggingConnection(ISolrConnection connection)
    {
        this._solrConnection = connection;
    }

    public string Post(string relativeUrl, string s)
    {
        _log.DebugFormat("POSTing '{0}' to '{1}'", s, relativeUrl);
        return _solrConnection.Post(relativeUrl, s);
    }

    public string PostStream(string relativeUrl, string contentType, Stream content, IEnumerable<KeyValuePair<string, string>> getParameters)
    {
        _log.DebugFormat("POSTing to '{0}'", relativeUrl);
        return _solrConnection.PostStream(relativeUrl, contentType, content, getParameters);
    }

    public string Get(string relativeUrl, IEnumerable<KeyValuePair<string, string>> parameters)
    {
        var stringParams = string.Join(", ", parameters.Select(p => string.Format("{0}={1}", p.Key, p.Value)).ToArray());
        _log.DebugFormat("GETting '{0}' from '{1}'", stringParams, relativeUrl);
        return _solrConnection.Get(relativeUrl, parameters);
    }
}

the question about DateTime Search

in my schema.xml have a field named SaleDate,its multiValued="true".It stores the time data is a list 。like this ["2014-03-31T16:00:00Z","2014-03-29T13:00:00Z","2014-03-30T15:00:00Z","2014-03-30T19:00:00Z"] .now iwant to use solrnet to get results ,Contains data for a time(2014-03-30 19:00:00) the SoltNet Code how to write.thanks

Must specify a Content-Type header with POST requests - Solr 4.7

I've just installed a new BitNami / Solr stack with 4.7 installed and tried to use the latest SolrNet.

Previous code that worked to push PDFs into the index no longer works, I receive the error above. Other documents work fine.

I've seen this bug post on Apache https://issues.apache.org/jira/browse/SOLR-5517 that states that Solr will throw an error when no content-type is set in the header and I also tried manually setting the content-type in SolrConntection.cs PostStream to "application/x-www-form-urlencoded" as per site http://qnalist.com/questions/4765256/updated-to-v4-7-getting-search-requests-cannot-accept-content-streams.

I rolled out a new version with this in place and it still did not index the documents.

Stack trace of error

[System.Net.WebException: The remote server returned an error: (415) Unsupported Media Type.]
at System.Net.HttpWebRequest.GetResponse()
at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable`1 parameters)

[SolrNet.Exceptions.SolrConnectionException: Must specify a Content-Type header with POST requests415 ]
at SolrNet.Impl.SolrConnection.PostStream(String relativeUrl, String contentType, Stream content, IEnumerable1 parameters) at SolrNet.Commands.ExtractCommand.Execute(ISolrConnection connection) at SolrNet.Impl.SolrBasicServer1.Send(ISolrCommand cmd)
at SolrNet.Impl.SolrBasicServer1.SendAndParseExtract(ISolrCommand cmd) at SolrNet.Impl.SolrBasicServer1.Extract(ExtractParameters parameters)
at SolrNet.Impl.SolrServer`1.Extract(ExtractParameters parameters)
at Every1.Ticker.Core.Web.Search.AddResource(spResourcesForIndexResult resource)

Make the NuGet packages relevant again

The title says it all. SolrNet has been prerelease forever now, and we're using it but we're building packages ourselves because the current packages are outdated and available as 'prerelease' only.

Nuget package outdated

Hi,
I ran into some issues when I was using Solrnet from the nuget package, it couldn't find SolrQueryByDistance class, then I read that it might be outdated, after getting the dll (0.4) from build its all good. But I was wondering if nuget package will be updated anytime soon. I am not sure how often new dlls will be dropped to the build server it doesn't like a reliable option for Production environment.

GetSchemaCommand has hardcoded value for 'schema.xml'

The GetSchemaCommand has 'schema.xml' name hardcoded inside it. This can cause problems when people are using a non-standard schema name (zookeeper setup for example).

    public class GetSchemaCommand : ISolrCommand {
        /// <summary>
        /// Gets the raw Solr schema
        /// </summary>
        /// <param name="connection"></param>
        /// <returns></returns>
        public string Execute(ISolrConnection connection) {
            return connection.Get("/admin/file", new[] {new KeyValuePair<string, string>("file", "schema.xml")});
        }
    }

Proposal :

  • Overload of the Execute method that contains a string for alternative schema name.
  • Overload on GetSchema on SolrBasicServer with string for alternative schema name.

Field and Document Boost use culture specific string

Hi,

I'm having problems with the Boost, when I run my system under a Dutch culture setting. Currently I'm not able to commit changes, so I thing its just faster to post this as an issue.

Here's a test script that shows the result:

class Product
{
    [SolrField("inStock_b", Boost = 10.5f)]
    public bool InStock { get; set; }
}

[TestMethod]
public void Boost_Failure()
{
    //Please set SolrConnectionString!
    string SolrConnectionString = "";

    //Dutch locale
    System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("nl-NL");

    IEnumerable<object> instances = Startup.Container.GetAllInstances(typeof(ISolrOperations<Product>));
    if (!instances.Any())
        Startup.Init<Product>(SolrConnectionString);
    ISolrOperations<Product> _solr = ServiceLocator.Current.GetInstance<ISolrOperations<Product>>();

    Product product = new Product { InStock = true };
    IDictionary<Product, double?> dict = new Dictionary<Product, double?>
    {
        {  product, 10.5 }
    };

    _solr.Add(product); //throws Exception
    _solr.AddRangeWithBoost(dict); //also throws Exception
}

The cause of the first (Add), can be found in master, SolrDocumentSerializer.cs line 60:

boostAtt.InnerText = field.Boost.ToString();

I was not able to find the source for AddRangeWithBoost. But could you please add InvariantCulture to the ToString();

Maybe Query time boost is also not working because of this? I did not test this.

Sorting on Boolean type field

I have indexed "StockAvailability" field to Solr with true or false values. It means if products are in stock StockAvailability field has "True" value otherwise it has "False" value.

Now I want search result as per relevancy, means I want to show "In Stock" products first then "Out of Stock" products.

Example:

Assume if you search for "mouse", it returns 10 products. If product "mouse very special mouse" has no stock and remaining products have stock then I want to show all other products first which are in stock on search result page then out of stock products.

How can I perform a Solr as well as SolrNet query to do this?

Thank You

F# type provider

(moved from https://code.google.com/p/solrnet/issues/detail?id=190 )

Ideas to implement F# type providers around Solr:

  1. A type provider would infer the SolrNet document type from the Solr schema. From there SolrNet could pick up the inferred type and be used to do serialization/queries as usual. There could be two "modes", inferring two separate document types:
    • one for querying, which would include all stored fields
    • another one for indexing, which would include all non-copied fields.
  2. Another type provider would infer types modeling a strongly-typed query DSL. Each field type would produce a different query type. This would produce a much better query API than a LINQ provider.

Problem with manual mapping and required fields?

I think I have found a bug, at least I cannot explain the behavior after seraching for 2 hours.
I use manual mapping to build up my schema, and everything works fine, besides that I keep getting errors when I try to validate my mapping.
When I run queries the properties of the target objects are all null or empty.

The errors refer to required fields that would be missing, but actually I map them like the other fields.
Mapping error:
Required field 'doc_id' in the Solr schema is not mapped in type 'Wise.ClientService.SkbDoc'.
Required field 'author' in the Solr schema is not mapped in type 'Wise.ClientService.SkbDoc'.

And so on, 5 required fields, 5 errors.

Do I miss that I have to deal with required fields in a different way or could this really be a bug?

Thank you in advance,

Markus

Multiple collations in spellcheck

(moved from https://code.google.com/p/solrnet/issues/detail?id=211 )

SolrNet does not currently support multiple collations. SpellCheckResponseParser and SpellCheckResults should be modified to support this.

To avoid multiple breaking changes, things should be changed to support extended results as well ( http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collateExtendedResults ).

New objects encapsulating this data should be immutable.

The patch/pull request must include tests for the cases of single collation, multiple simple collation, and multiple extended collations.

There was a pull request for this some time ago, but it lacked tests and objects were not immutable: #24 , still it could be used as reference.

Script Solr download

The git repository is getting more and more bloated every time I update Solr. Instead of committing it to the repository, create a script that downloads it, unzips it and replaces config/schema.

Problem with making request to Stats component with Date field

Added field with type date to QueryOptions.Stats.FieldWithFacets and got:

Line 71:                 switch (name) {
Line 72:                     case "min":
Line 73:                        r.Min = Convert.ToDouble( statNode.Value, CultureInfo.InvariantCulture );
Line 74:                         break;
Line 75:                     case "max":
[FormatException: Input string was not in a correct format.]
   System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) +542
   SolrNet.Impl.ResponseParsers.StatsResponseParser`1.ParseStatsNode(XElement node) in F:\_SolrNet\SolrNet\Impl\ResponseParsers\StatsResponseParser.cs:73
   SolrNet.Impl.ResponseParsers.StatsResponseParser`1.ParseStats(XElement node, String selector) in F:\_SolrNet\SolrNet\Impl\ResponseParsers\StatsResponseParser.cs:52
   SolrNet.Impl.ResponseParsers.StatsResponseParser`1.Parse(XDocument xml, SolrQueryResults`1 results) in F:\_SolrNet\SolrNet\Impl\ResponseParsers\StatsResponseParser.cs:38
   SolrNet.Utils.<>c__DisplayClass1`1.<ToFunc>b__0(T x) in F:\_SolrNet\SolrNet\Utils\Unit.cs:29
   SolrNet.Impl.ResponseParsers.AggregateResponseParser`1.Parse(XDocument xml, AbstractSolrQueryResults`1 results) in F:\_SolrNet\SolrNet\Impl\ResponseParsers\AggregateResponseParser.cs:15
   SolrNet.Impl.SolrQueryExecuter`1.Execute(ISolrQuery q, QueryOptions options) in F:\_SolrNet\SolrNet\Impl\SolrQueryExecuter.cs:589

SolrNet Question of SolrQueryByRange<DateTime>

There is no effect,Search result is Null.

new SolrQueryByRange<DateTime?>("SaleDate_E", DateTime.Now,null)

No search results,Is write wrong?
there are other ways to solve the problem?

thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.