Giter VIP home page Giter VIP logo

Comments (2)

sphildreth avatar sphildreth commented on May 22, 2024

I ended up modifying the search method in ElasticClient-Search.cs;

        public QueryResponse<T> Search<T>(string search, string typeName = null) where T : class
    {
        return this.Query<T>(search, typeName);
    }

Then modifying the Query Method as well;

    private QueryResponse<T> Query<T>(string query, string type = null) where T : class
    {
        var index = this.Settings.DefaultIndex;
        index.ThrowIfNullOrEmpty("Cannot infer default index for current connection.");

        var queryType = typeof(T);
        var typeName = type != null ? type : this.InferTypeName<T>();
        string path = this.CreatePath(index, typeName) + "_search";

        var status = this.Connection.PostSync(path, query);
        if (status.Error != null)
        {
            return new QueryResponse<T>()
            {
                IsValid = false,
                ConnectionError = status.Error
            };
        }
        var response = JsonConvert.DeserializeObject<QueryResponse<T>>(status.Result, this.SerializationSettings);

        return response;
    }

This of course requires usage of .NET 4.0 with the optional parameter, not sure if you want a pull request to move to 4.0 or not.

from elasticsearch-net.

Mpdreamz avatar Mpdreamz commented on May 22, 2024

Hey thanks for taking the effort to fix it yourself :) For now i'd like to be 3.5 compatible, hence all the overload madness :(

Search is still under heavy development, right now it only maps queries. I am working on facets at the moment and then working on highlighting. Focus is sadly only on getting all the search responses mapped properly before deciding on query DSL and clouding search with 30 overloads :)

from elasticsearch-net.

Related Issues (20)

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.