I have a simple requirement, I'm being passed conditions and their values and need to determine exact fit (if possible) and best match (when no exact fit is found).

For Example:

Condition_1: age < 25
Condition_2: weight > 140
Condition_3: height > 69
Condition_1: age > 25
Condition_2: weight > 140
Condition_3: height > 69

In the example above, if I were to pass:
age = 26
weight = 130
height = 75

Neither rule would be an exact match, but Rule_2 matches two of the conditions where as Rule_1 only matches one. Therefore Rule_2 is the best match.

For my requirement, I may have up to 30,000 rules to match and will have to do so quite frequently (several times per second). I also have the added requirement that different weights will be applied to each condition making some conditions more important than others.

I do not need to perform any action based on the condition. The only action is to return a sorted collection of rules that match along with the score/percentage of the match.

I have not found a Rules Engine that can do this so far (if there is, please let me know), which has lead me to utilizing a search engine like Lucene to handle the task.

I know Lucene can handle the load and has good indexing capabilities, but my question is, can Lucene be used for this type of task and would it be efficient to do so?