Giter Site home page Giter Site logo

Sorting about flexsearch HOT 5 CLOSED

nextapps-de avatar nextapps-de commented on May 5, 2024
Sorting

from flexsearch.

Comments (5)

ts-thomas avatar ts-thomas commented on May 5, 2024 2

That's a good point. I will add this feature to the task: "adding complex objects to the index" that makes the result sort-able by any field.

from flexsearch.

pantchox avatar pantchox commented on May 5, 2024 1

this is a good solution for categories, but what about sorting by timestamp?

from flexsearch.

ThomasG77 avatar ThomasG77 commented on May 5, 2024 1

I don't find "Custom sort". It seems it has been dropped since 0.7? Wrong deduction on my side or really removed?

from flexsearch.

ts-thomas avatar ts-thomas commented on May 5, 2024

I have already thought about customize sorting. This requires the indexing of more complex objects to sort by different attributes from the index. In this case, the flexible weighting of these attributes for a search would also be possible. I do not know exactly what your search requirements are, but when it comes to filtering, you can already do that pretty well with FlexSearch.

Define helpers:

var index = {};

function add(id, cat, content){
    (index[cat] || (
        index[cat] = new FlexSearch()
    )).add(id, content);
}

function search(cat, query){
    return index[cat] ? index[cat].search(query) : [];
}

Add content to the index:

add(1, "action", "Movie Title");
add(2, "adventure", "Movie Title");
add(3, "comedy", "Movie Title");

Perform queries:

var results = search("action", "movie title"); // --> [1]

This way you can also provide different settings for each category.

from flexsearch.

ts-thomas avatar ts-thomas commented on May 5, 2024

Custom sorting is supported now: https://github.com/nextapps-de/flexsearch#custom-sort

from flexsearch.

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.