elasticlunr.js
elasticlunr.js copied to clipboard
Boolean is always OR, even if AND is configured
Starting with the example at http://elasticlunr.com/example/index.html Configuring the boolean mode to AND has no effect, the same OR logic is still applied.
Test: [1] Use the config file
{
"fields": {
"title": {"boost": 2},
"body": {"boost": 1}
},
"boolean": "AND"
}
[2] Add the query word "checkbox" in the search input field. Only 4 results are listed. [3] Now add the word "return" in the search input field. -- Expected: Fewer results -- Actual: Much more results!
I picked this lib up today and ran into the same problem with the example page.
The problem seems to only exist on that page (running version 0.9.5 like I do on my computer). Running on my own generated index, boolean mode works. I'm guessing that the example page does not use the configuration at all.
Also note that the config name must be "bool" and not "boolean" as per elasticlunr.js/lib/configuration.js .
I ran into this as well - 2.5 years later on (which makes sense; the last publish was 5 years ago). I just can't tell if it's a problem with the boolean logic or with how the search configuration in that example is implemented.