3

I have a JavaFX application with a TableView. The user can filter the displayed rows with a search term they enter in a TextField.

Currently I iterate over all cells and use simply String.contains().
I want to enhance it, so the user can also enter e. g.:

"hello OR hallo -world columnB:abc".  
-> include or exclude ("-world"), 
AND or OR combinations, search in particular columns ("columnB:abc") and so on.

Is there an existing library which I can use?

I searched on the web, but didn't find a library for this use case.
Search engines like Apache Lucene, Apache Solr, Elasticsearch seem not to fit (overload for this simple use case and I have already structured data (TableView) - no full text.

1 Answer 1

1

ANTLR

Found a promising solution: a parser generator like ANTLR. (See Wikipedia.)

Using a grammar file as input it allows you to generate a parser. With it you get a parse tree at runtime which you can then process in your application.

1
  • You could improve your answer by summarising its features. Link only answers may get removed by the bot. Commented Jan 2, 2023 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.