Building Queries
Even if you are using the QueryParser to build all your queries, you’ll
gain a better understanding of how searching works in Ferret by building
each of the queries by hand. We’ll also include the Ferret Query Language
(FQL) syntax for each different type of query as we go. As you read,
you’ll find some queries that you can’t build even using the QueryParser, so it will be useful to learn about
them as well.
Before we get started, we should mention that each Query has a boost field. Because you will
usually be combining queries with a BooleanQuery, it
can be useful to give some of those queries a higher weighting than the
other clauses in the BooleanQuery. All Query objects also implement hash and eql?, so they can be used in a HashTable to cache query results.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access