jurismarches / luqum

A lucene query parser generating ElasticSearch queries and more !
Other
188 stars 40 forks source link

Add basic support for regex type in parser #52

Closed psanford closed 4 years ago

psanford commented 4 years ago

This simply allows you to distinguish regex from words. It does no internal parsing of the regex text.

Before:

>>> parser.parse('/foo bar/')
UnknownOperation(Word('/foo'), Word('bar/'))

After:

>>> parser.parse('/foo bar/')
Regex('/foo bar/')
alexgarel commented 4 years ago

Wow thank you for this was in the TODO !

Could you fix the flake8 minor problem, reported by travis:

make quality

flake8 luqum

/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/pep8.py:110: FutureWarning: Possible nested set at position 1

  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')

luqum/tree.py:208:1: E302 expected 2 blank lines, found 1

Makefile:5: recipe for target 'quality' failed

make: *** [quality] Error 1

The command "make quality" exited with 2.
coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 0ab316cf02ef694bf8a3f5ebc78734ef90ace4d6 on psanford:support-parsing-regex into 08be8e57e10e21b3d06bffee6a0417cf59e2b2cc on jurismarches:master.

psanford commented 4 years ago

Fixed!

Thanks for this library!