It&#39;s possible that putting the &quot;constants&quot; into rules will result in a rule building process that&#39;s more complex than what you need to do if this data is in facts. Notice that your Object_1 has to participate in (at least) three different matching scenarios, which is a simple thing for a fact, but may need three rules if FirstName and LastName are literals in rules.<br>
<br>A (serially) reusable Stateful Session would need to be set up with the 10k facts. A search request enters an object, produces results, and retracts the request; then the session is ready for the next request. (The N threads you are talking about results from some overall application context?)<br>
<br>Regards<br>Wolfgang<br><br><div class="gmail_quote">2011/4/18 Drools User <span dir="ltr">&lt;<a href="mailto:drools2030@gmail.com">drools2030@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have been using 
Drools for several years, but just with constraints (rules) on 1 set of 
objects at a time. Think many rules, few facts in a stateless session. I
 have been given a new project at the office which requires having about
 10-100k facts and few rules. These 10k facts would be basically 
constants, a list of things I need to search on each request. I would 
then need to load a single object, based on a request to see if my 
request object matched the list. It is somewhat a simple search, but I 
need to be able to inject aliases and search partial matches in addition
 to exact matches. A generic example:<br>
<br>List:<br>Object 1 (FirstName=John, LastName=Smith)<br>Object 2 (FirstName=Will, LastName=Smith)<br>Object 3 (FirstName=Jon, LastName=Smith)<br><br>Request/Use Case:<br>LastName=Smith, would return all 3 objects, but marked as single match<br>


LastName=Smith, Firstname =John, Would return object 1, as exact double match, and Object 3 a nickname double match <br>LastName=Smith, Firstname =J, Would return object 1 and 3, as partial match<br><br>In
 the second request, I need to run all names through a nickname DB/list 
to explode the name into multiple search patterns. Possibly using (<a href="http://code.google.com/p/nickname-and-diminutive-names-lookup/" target="_blank">http://code.google.com/p/nickname-and-diminutive-names-lookup/</a>)<br>


<br>Hopefully that explains a bit about the problem.<br><br>So to the 
question, there are a few ways to solve this. The simplest is just SQL 
from a DB, but this proves to be slow to search all the ways I need. I 
need sub second response times. An in memory DB is another possible 
solution we are looking at. Not to think of Drools as the golden hammer,
 but this smells like something I can use Drools for. My first thought 
was to load the &quot;List&quot; as facts into a stateful session. My concern is 
wouldn&#39;t I need N copies of the list loaded to have N threads? This 
would be inefficient if so. I know rules aren&#39;t copied per working 
memory, but is there a way to create a master working memory for facts 
to use? <br>
<br>So my second thought is to convert my List into rules so they would 
only be stored once in the system, regardless of number of threads using
 the engine.<br><br>What do you guys think, am I on the right track with
 this? Is Drools a good way to do this or is there something better I 
have overlooked?<br>
<br>Thank you for taking the time.<br><font color="#888888">-Drools user
</font><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>