the search ignores the symbols
See original GitHub issueHello,
I added flexsearch library to my application. This works very well in the most cases. However, I have problems when I try to perform searches that combine words and symbols like &, !, #, %. For example:
We have a collection with 4 items:
- Course&Some
- Course#Another
- Course%Foo
- Course!Bar
When I try searching the term ‘Course&’ (ignore single quotes), the library returns 4 results, ignoring the symbol &. I expect one result (the item number one). When I try searching the term ‘Course&Another’ (ignore single quotes), the library returns 3 results (items two, three and four). I expect zero results.
So, my questions are:
- How should I proceed so that the library does not ignore the symbols when searching?
- Is there a way to improve the behavior of the library with cases like the ones mentioned?
I am using this configuration:
var index = new FlexSearch({
encode: "advanced",
tokenize: "full",
depth: 3,
threshold: 0,
async: false,
worker: false,
cache: false,
doc: {
id: "Id",
field: [
"Field1",
"Field2"
];
}
});
index.add(collectionItems);
I perform the search in the following way:
var params = { field: ["Field1", "Field2"], query: text, bool: "or" }
index.search(params, function (results) {
//More code
}
Thanks in advance.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Why do search engines ignore symbols? - Stack Overflow
Why do search engines seem to ignore symbols completely? They are just characters like any others. I can see why it would be...
Read more >Why does Google search STILL ignore symbols? - Quora
The insignificant words and symbols are ignored because they don't add anything to the quality of the results retrieved.
Read more >Google Ignores Symbols For Rankings
John Mueller of Google said that Google, for ranking and SEO purposes, ignores all symbols - including the registered trademark symbols such ...
Read more >8 Easy Symbols to Make Google Work Better for You
– (Negative Symbol): adding '-' before a word in a query will tell a search engine to ignore pages that use that word...
Read more >Refine web searches - Google Search Help
You can use symbols or words in your search to make your search results more precise. Google Search usually ignores punctuation that isn't...
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
@carlinmack Thanks for taking an interest! I delved a little deeper and found that this works fine for my purposes:
I think it will also suit the riginal poster @javierperini.
I reckon the tokenize function full takes in your input and sanitises it, I would define a custom encoding function