Giter Site home page Giter Site logo

Facets? about chewy HOT 13 CLOSED

toptal avatar toptal commented on May 24, 2024
Facets?

from chewy.

Comments (13)

pyromaniac avatar pyromaniac commented on May 24, 2024

https://github.com/toptal/chewy/blob/master/lib/chewy/query.rb#L235-L248

from chewy.

USvER avatar USvER commented on May 24, 2024

But how do i get results?

from chewy.

pyromaniac avatar pyromaniac commented on May 24, 2024

If called parameterless - returns result facets from ES performing request.

# Returns empty hash if no facets was requested or resulted.

from chewy.

USvER avatar USvER commented on May 24, 2024

So only facets or query results but not both?
So to get query results AND facets i need to run query two times?

from chewy.

pyromaniac avatar pyromaniac commented on May 24, 2024

Nope,

scope = UsersIndex.filter(...).facets(...)
scope.facets #=> facets
scope.to_a #=> result
scope.map do |user|
  ....
end #=> within the only one request

from chewy.

USvER avatar USvER commented on May 24, 2024

Thank you! Sorry for bothering you...

from chewy.

pyromaniac avatar pyromaniac commented on May 24, 2024

Welcome!

from chewy.

USvER avatar USvER commented on May 24, 2024

Amazing gem and search engine! Thank you guyz! The only solution that worked for me...

from chewy.

jumph4x avatar jumph4x commented on May 24, 2024

@pyromaniac Can you guys re-open this issue? Assign it to me, I'll gladly document facet use.

Nearly started switching to another gem because I didn't realize the support was there to begin with.

from chewy.

pyromaniac avatar pyromaniac commented on May 24, 2024

Would be awesome. Unfortunately, I'm unable to assign it to you, but we both know ;)

from chewy.

jumph4x avatar jumph4x commented on May 24, 2024

No worries.

from chewy.

jumph4x avatar jumph4x commented on May 24, 2024

Time to close :)

from chewy.

USvER avatar USvER commented on May 24, 2024

Thank you!

from chewy.

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.