One of the key variables in the optimization of the retrieval process is the logic imposed on a set of query terms. If the query is small, a combinatorial algorithm can be employed to identify search expressions having an optimal logical form. An experiment is described in which this was done for queries expressed against MEDLINE, for a variety of criterion variables. The method employed is useful not only for assisting in identifying optimal logical forms, as demonstrated, but also as an experimental control device to assist investigations into the effects of varying the set, and number, of search terms. The experiment also suggests several novel properties of effective searching against MEDLINE, for example that searching with four MeSH terms is likely to be more successful than searching with a lesser number of terms, provided search logic is optimal. The latter result is, surprisingly, true for both Precision and Recall, i.e., a tradeoff between the maximally attainable values of these variables fails to hold when the number of search terms varies in this range.