There may be situations where you would like to make your index smaller. The reasons may be different—you may want to have a smaller index so that it would fit into the operating system's I/O cache or you want to store your index in RAMDirectory
. This recipe will try to help you with the process of index slimming.
The following steps tell us how to make your index smaller:
For the purpose of this recipe, I assumed that we will have four fields that describe the document. I created the following index structure (add this to your
schema.xml
file):<field name="id" type="string" indexed="true" stored="true" required="true" /> <field name="name" type="text" indexed="true" stored="true" /> <field name="description" type="text" indexed="true" stored="true" /> <field name="price" type="string" indexed="true" stored="true" />
Let's assume that our application has the following requirements:
We need to search on
name
anddescription...