Giter VIP home page Giter VIP logo

Comments (2)

joemcelroy avatar joemcelroy commented on June 11, 2024

As you mentioned, you need to setup sorting in the configuration.

See example: https://www.searchkit.co/docs/components/sort-by#searchkit-setup

in the example you gave, it should be:

search_settings: {
  // ...
  sorting: {
    default: {
      field: '_score',
      order: 'desc'
    },
    _price_desc: {
      field: 'price',
      order: 'desc'
    },
    _price_asc: {
      field: 'price',
      order: 'asc'
    }
  }
}

this means it will continue to use the same index but will sort based on the field specified. the component will specify "regular_index_price_desc", the "_price_desc" will match the indexName and search on "regular_index" + sorting config of `_price_desc".

you shouldn't need to create an alias or clone for the sorting index. It should just work off the one index.

Query sorting is the only way you want to do but would say sorting other than score is not a good idea. You can use boosting to adjust relevance of certain documents too which might give a better experience.

Hope that makes sense!

from searchkit.

kristinn93 avatar kristinn93 commented on June 11, 2024

Thanks for the response @joemcelroy !
I've setup a new client, did everything very similar, and now it works as expected ✅.
Not sure why I encountered problems with requests going to another index the first time I tried this.

from searchkit.

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.