Comments (5)
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.
this is a good solution for categories, but what about sorting by timestamp?
from flexsearch.
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.
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.
Custom sorting is supported now: https://github.com/nextapps-de/flexsearch#custom-sort
from flexsearch.
Related Issues (20)
- Current NPM package is stale HOT 2
- Cloning of flexsearch objects
- new Document causes `.default is not a constructor` error HOT 1
- Benchmark link is broken HOT 1
- Setting a string as "encode" doesn't work (confusing document?) HOT 1
- How to return context (+ or - few lines) around the hits of given search text
- Enriched document search showing duplicate results
- I have a question about how the results are sorted HOT 2
- Do not force string in Index#add() when custom encoder
- "Document Indexes" link in readme is broken
- Typo in cdn link
- TypeScript doesn't allow omitting id from the document descriptor while the README says it is allowed
- document search option "pluck" is rejected by TypeScript
- Some documents may appear multiple times in the search result
- Error: export 'Document' (imported as 'Document') was not found in 'flexsearch' (possible exports: default) HOT 2
- Add French language pack HOT 1
- return one if exact match? HOT 1
- Having issue indexing entry with symbols/ special characters
- Is there a way to create an offline index in PHP or Python?
- 咨询检索配置(缓存值: "多大的;多少平" 使用:search("是多少平的") 没有返回结果,想要可以返回应该怎么做呢)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flexsearch.