Błażej Rejnowski
Błażej Rejnowski

Reputation: 259

Solrj indexing mechanism

I have a question about indexing mechanism using Solr in Java. If I create a documents and i want to find only field "name", solr will be index all fields? Or only index by field "name" in each document?

Upvotes: 0

Views: 113

Answers (2)

Anand Mattikopp
Anand Mattikopp

Reputation: 372

In the schema.xml where you define the fields getting used, you need to mention indexed=true for all the fields you want to search on.

In your case it would look something like this -

<field name="name" type="string" indexed="true" stored="true" />

Upvotes: 0

MatsLindh
MatsLindh

Reputation: 52862

If you tell Solr to only store the field name in your schema, then only the field name will be stored.

If you instruct Solr to store everything you send to it (like in the schemaless mode) and you send 400 fields, each of those fields will be stored.

If you want to store information but not search for it, only those fields which you are going to query need to be indexed, while the other fields can be limited to just stored. If you don't need the content of the field, but just want to search for it, you can set stored to false, and indexed to true.

Upvotes: 0

Related Questions