FoundatioFx / Foundatio.Parsers

A lucene style query parser that is extensible and allows modifying the query.
https://www.nuget.org/packages/Foundatio.Parsers.LuceneQueries/
Apache License 2.0
66 stars 19 forks source link

Parsing Spaces in Field Names #70

Closed mrkresc closed 2 years ago

mrkresc commented 2 years ago

It looks like Foundat.io Lucene Parser doesn't like to parse spaces in field names.

Adding a link to StackTrace as it looks like that space needs to be escaped and a screenshot showing a simple test case.

https://stackoverflow.com/questions/23257495/lucene-query-syntax-of-field-with-a-space

image

ejsmith commented 2 years ago

Hmm... I learned something new today. I didn't know that was valid. :-)

mrkresc commented 2 years ago

You and me both :-) I knew Elastic supported it but figured they were replacing the space with something else. That is actually the issue I am having. Validating a query before adding it to a query string Elastic query.

ejsmith commented 2 years ago

@mrkresc curious, what do you use this library for?

mrkresc commented 2 years ago

We use it to parse Lucene queries (in our application) to validate them before injecting them into a query string query to our Elasticsearch cluster. There are certain types of queries that are heavier on Elasticsearch that we don't allow. (I.E. Regex queries) Your library gives a nice easy way to parse queries and detect certain things that we don't allow to be run on our cluster.

There are two ways to parse lucene queries in Elastic and both have pitfalls

1) Simple Query String - Less Robust 2) Query String - Less Secure.

We use this library to make the Query String query more secure.

On Fri, Oct 15, 2021 at 12:31 PM Eric J. Smith @.***> wrote:

@mrkresc https://github.com/mrkresc curious, what do you use this library for?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FoundatioFx/Foundatio.Parsers/issues/70#issuecomment-944474551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4AUJM6AYMHMK3FCQ7NFWTUHBQOBANCNFSM5GCLZB4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ejsmith commented 2 years ago

Very cool! Thanks for the info. I'm working on adding support for spaces now.

ejsmith commented 2 years ago

This should be resolved in the latest release. Thanks!

mrkresc commented 2 years ago

Very much appreciate the support and quick turn around!