3.1 Search strategies

When doing searches you will need to do something of a balancing act. There is always a demand for more complex searches, while often most users will be happy with a simpler search if it returns the results they want. That is one of the main premises behind the LIKEP search. A single simple search returning the best answers first. If you can avoid the work of filtering thousands of records, or reordering, or having the user click the next page button a hundred times, everyone will be a winner. If you decide you need more complicated searches then they should be carefully constructed both for performance, and again to return the most wanted results first.

Once you know what you want the query to do, the next stage is writing it. The general rule when writing the query is to put the most restrictive clauses first. If you have a metamorph compound index you should generally put the LIKE clause first, as that is one of the most expensive to evaluate if an index is not used.

Back: Creating Queries Next: Ordering clauses
Copyright © 2024 Thunderstone Software LLC. All rights reserved.