Book Image

Solr Cookbook - Third Edition - Third Edition

By : Rafal Kuc
Book Image

Solr Cookbook - Third Edition - Third Edition

By: Rafal Kuc

Overview of this book

This book is for intermediate Solr Developers who are willing to learn and implement Pro-level practices, techniques, and solutions. This edition will specifically appeal to developers who wish to quickly get to grips with the changes and new features of Apache Solr 5.
Table of Contents (18 chapters)
Solr Cookbook Third Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Avoiding caching of rare filters to improve the performance


Imagine that some of the filters you use in your queries are not good candidates for caching. You might wonder why—for example, do those filters have date and time with seconds or are spatial filters scattered all over the world? Such filters are quite unique, and thus when they are put into the cache, they are very rarely reused and thus they are more or less useless. Caching such filters is a waste of memory and CPU cycles. Is there something you can do to avoid filter queries caching? Yes, there is a way, and this recipe will show you how to do it.

How to do it...

Let's assume we have the following query being used to get the information we need:

q=solr+cookbook&fq=category:books&fq=date:[2014-06-12T13:22:12Z+TO+2014-07-11T11:24:54Z]

The filter query we don't want to cache is the one filtering our documents on the basis of the date field. Of course, even though we don't want that filter to be cached, we still want the filtering...