I would like to implement an advanced search for my project. The search right now uses all the strings the user enters and makes one big clause with the criteria API.
This works fine, but now I would like to implement more features: AND, OR and brackets ()
It's hard for me to parse a line - and build criteria from a line. I found https://stackoverflow.com/a/167408/ ... but it didn’t help (he didn’t make it clear what he needed).
I found another article , but it supports much more and spits out SQL expressions. Another thing I've heard a lot about is Lucene, but I'm not sure if this will really help me.
I searched a bit and I found Lucene.Net WhitespaceAnalyzer and QueryParser.
It changes the search A AND B OR C to something like + A + BC, which is a good step in the right direction (plus it processes the brackets). The next step would be to convert the converted string to a set of alliances and clauses.
The Java example I found used a query builder that I could not find in NHibernate.
Any ideas?
source
share