Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anti-slashes are not properly handled #40

Open
Crystark opened this issue Mar 10, 2021 · 2 comments
Open

Anti-slashes are not properly handled #40

Crystark opened this issue Mar 10, 2021 · 2 comments

Comments

@Crystark
Copy link

Hello.

I'm trying to use a field name with a space in it. It seems that I can make this work with the java lucene SyntaxParser but not with your library (please omit the fact that using a space in a field name is probably a very bad idea ;) ).

Here is what I do in Java:
image

And here a re a couple tests that give inconsistent results afaik:

image

Here is the code to reproduce:

var lucene = require("lucene")
var ast = lucene.parse('name:"hello there" AND (tags.tag one:(a OR c) AND tags.tag2:b)');
console.log(lucene.toString(ast), "as expected 1");

ast = lucene.parse("name:\"hello there\" AND (tags.tag one:(a OR c) AND tags.tag2:b)");
console.log(lucene.toString(ast), "as expected 2");

ast = lucene.parse("name:\"hello there\" AND (tags.tag\ one:(a OR c) AND tags.tag2:b)");
console.log(lucene.toString(ast), "not sure what was to expect here but feels weird to have lost the antislash");

ast = lucene.parse("name:\"hello there\" AND (tags.tag\\ one:(a OR c) AND tags.tag2:b)");
console.log(lucene.toString(ast), "if we lost the antislash previously we should have had one antislach here i suppose ?");

ast = lucene.parse('name:"hello there" AND (tags.tag\ one:(a OR c) AND tags.tag2:b)');
console.log(lucene.toString(ast), "I was definitly expecting the anti slash to remain here");

ast = lucene.parse('name:"hello there" AND (tags.tag\\ one:(a OR c) AND tags.tag2:b)');
console.log(lucene.toString(ast), "And here suddenly I have two anti slashes");
@Crystark
Copy link
Author

this is actually linked to #38

@gajus
Copy link

gajus commented Nov 7, 2021

This is correctly handled in https://github.com/gajus/liqe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants