Advanced query example?
See original GitHub issueI’m trying to use FlexSearch for building a search that acts a lot like the lucene language, so support for logical operators (using either AND
, NOT
or +
, -
respectively as well as OR
), quotes/exact phrase match (“foo bar” won’t match the text “bar foo”).
From the README’s supported features table it looks like FlexSearch can do that, but I couldn’t seem to get it to work using even a “wasteful” configuration, as well as a basic query:
const index: Index<string> = FlexSearch.create({
tokenize: 'full',
encode: 'extra',
stemmer: false,
});
index.add(1, 'foo');
index.add(2, 'bar');
index.add(3, 'foo bar');
index.add(4, 'bar foo');
const values = index.search([
{ query: 'foo' },
{ query: 'bar' },
]); // values is an empty array
If I use the string overload of search
: index.search('foo bar')
it does find id 3 and 4, but how can I specify that only one of them is required for example, or that the I want the full query as a phrase (i.e. id 3 is valid, 4 is not).
So, a couple of questions:
- Am I missing something?
- Is what I want to do even possible with FlexSearch? If so, how can I achieve that? Ideally I’d just configure the operators in the
create()
call, and thensearch()
can parse it automatically based on that.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:18 (5 by maintainers)
Top Results From Across the Web
TOP-70 Most Important SQL Queries in 2022 - ByteScout
The following are some database queries examples that deal with creating tables, in a bit more advanced fashion. Create a table with a...
Read more >How to Do Advanced Queries in MySQL - Universal Class
Let's take the following query as an example: SELECT COUNT(customer_id) FROM Customer; The above statement counts the number of customer records in your ......
Read more >Complex SQL Query Example - Daily Order Analysis
Introduction. This article is a case study on writing a complex query on an SQL database. We start with a set of database...
Read more >Complex SQL Queries Examples(90% ASKED IN Interviews)
Complex SQL Queries · 1.Query to find Second Highest Salary of Employee?(click for explaination) · Answer: · 2.Query to find duplicate rows in...
Read more >SQL Advanced Query Samples for Dummies - Overview
The purpose of this application is to present practical examples of using advanced SQL commands for your daily life, such as: SQL Tips...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ts-thomas I didn’t see that issue on my previous search. Too bad it’s not supported. I voted for it there anyway, and this issue and upvotes and attention it received strengthens that it’s a needed (wanted) feature 😃. I hope it’s taken into account as a feature request in a future release. This is what we wanted to use Flexsearch (or others) for.
Please change over to the version >= 0.7.x, thanks a lot.