Search within results of another query

User 4e4b708dbd

18-12-2013 09:24:19

Lets assume I run a Query A and get a large number of hits (100K, for example). I want then to run another query within this list. Is that possible with JChem Base?

ChemAxon 4a2fc68cd1

18-12-2013 11:40:41

Hi,


The easiest way to achieve this is by using the filter ID list feature of JChemSearch. If you use the Java API, you can use it like this:


searcher = new JChemSearch();
// ... - set connection hadler, table name, search options, etc.

searcher.setQueryStructure(query1);
searcher.run();
int[] results1 = searcher.getResults();

searcher.setQuerySturcutre(query2);
searcher.setFilterIDList(results1);
searcher.run();
int[] results2 = searcher.getResults();


Regards,
Peter

User 4e4b708dbd

18-12-2013 11:59:55

Peter,


And that will work with 100K IDs?


Imants

ChemAxon 4a2fc68cd1

18-12-2013 12:52:42

Hi Imants,


Yes, this method works with 100k or even more IDs without performance issues. Actually, it is never slower than performing the second search without filter ID list, because the given list cannot be larger than the list of all IDs in the table.


Peter

User 4e4b708dbd

09-04-2014 15:07:26

Hi Peter,


Indeed - this works even with millions of IDs. And it works fast. 


However, I am wondering if and how it will work in an environment, where many users use it simultaneously. Let's say I have several such lists. Some are "just" a few hundred thousand IDs, others are lists of millions of compounds. There are multiple users accessing the database simultaneously. Is this filtering option meant to be used this way? Have you tested it in a multi-user environment with list containing millions of compounds? 


Regards,


Imants

ChemAxon 9c0afc9aaf

11-04-2014 06:28:51

Hi,


 


I see no reason why you should be worried about multiple users.


Of course simultaneous searches will need more processing memory than a single search, but that is the case even without using this specific functionality - huge ID lists will just add somewhat to this memory need.


Please also note that this function does Not put any extra stress on the database  - the supplied list just simply taken into account during the in-memory fingerprint screening phase.


Best regards,


Szilard