简体   繁体   中英

Solr schema.xml field confusion

im new to solr so i really need someone to help me understand the fields below. What's the meaning of the field if it's stored=false, indexed=false? see the two examples below, what's the differences? If the field is not stored, what's the use of it...

    <field name="test1" type="text" indexed="false"
        stored="false" required="false" />

How about this one?

    <field name="test2" type="text" indexed="false"
        stored="false" required="false" multiValued="true" />

Thanks a lot!

It's easier than it seems:

  • indexed : you can search on it
  • stored : you can show it within your search results

In fact, there might be fields that you don't use for search, but you just want to show them within the results. On the other hand, there might be fields that you want to show within the results but you don't want to use for search. The stored=false is important when you don't need to show a certain field, since it improves performance. If you make all your fields stored and you have a lot of fields, Solr can become slow returning the results.

Of course, having both false doesn't make a lot of sense, since the field would become totally useless.

The unique difference between your two fields is the multiValued=true , which means that the second field can contain multiple values. That means that the content of the field is not just a text entry but a list of text entries.

You can find best explanation from Solr wiki.

If you want a field to be searchable then you should set indexed attribute to true.

indexed=true : True if this field should be "indexed". If (and only if) a field is indexed, then it is searchable, sortable, and facetable.

If you want to retrieve the field at the search result then you should set stored attribute to true.

stored=true : True if the value of the field should be retrievable during a search

If you want to store multiple value in a single field then you should set multivalued field to true.

multivalued=true : True if this field may contain multiple values per document, ie if it can appear multiple times in a document

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM