SOLR multivalued instructions for use

Source: Internet
Author: User

The Schema.xml configuration file for Solr has a property when configuring filed:

mutivalued:true If this field may containmutiple the values per Documents, This description is a little blurry, the following actual application, List two different examples .

Example one: A field has multiple values, values from the same filed

[HTML]View Plaincopy
  1. <fields>
  2. <!-- General-
  3. <field name="id" type="int" indexed="true" stored="true" mult ivalued="false" required="true"/>
  4.  <field name=" plantime "    type= "Tdate"    indexed= "true"   stored= "false"   multivalued= />  
  5.  <field name=< Span class= "Attribute-value" > "state"    type= "string"    indexed= "true"   stored= " False "  multivalued=" false "  />  
  6.  <field name=" overdate "   type=" String "   indexed=" true "  stored= "false"   multivalued= />  
  7.  <field name=< Span class= "Attribute-value" > "type"    type= "int"    indexed= "true"   stored= " False "  multivalued=" false "  />  
  8.  <field name=" contactName "   type=" Textcomplex "   indexed=" true "   stored= "false"    Multivalued=/>  
  9.  <field name=< Span class= "Attribute-value" > "Contacttel"     type=" string "   indexed=" true "  stored=" false "   multivalued= "false"  />   
  10.  <field name=" customer "    type= "Textcomplex"    indexed= "true"    stored= "false"    Multivalued=/>  
  11.  <field name=< Span class= "Attribute-value" > "alias"     type= "Textcomplex"    indexed=" true "  stored=" false "   multivalued= "false"  />   
  12.  <field name=" englishname "    type= "Textcomplex"    indexed=" true "  stored=" false "   multivalued= "false"  />   
  13. <field name="executor" type="int" indexed="true" stored="true" mult ivalued="true" />
  14. <!--[1m~k[1m~][1m~w segment --
  15. <field name="keywords" type="text" indexed="true" stored="false" multivalued="true"/>
  16. Lt;/fields>

among them:

[HTML]View Plaincopy
    1. <field name="executor" type="int" indexed="true" stored="true" Multiva lued="true"/

     Last look at the query effect:

     

      from Reading, executor this a field can be multiple values, any executor:29 or Executor:40 Similar queries can be found Id 3 records

      note: Use Solrj, such as:

[Java]View Plaincopy
    1. @Field
    2. Private set<integer> executor;
    3. Public set<integer> Getexecutor () {
    4. return executor;
    5. }
    6. Public void Setexecutor (set<integer> executor) {
    7. this.executor = executor;
    8. }

        

       example two: similar comprehensive search Span style= "FONT-SIZE:14PX;" >, combined with copyfiled, multiple filed copied to the field

       

         from See keywords area, is name, Introduction, Industryname Three collection, regardless of search name, Introduction, industryname any one, can be searched through keywords.

SOLR multivalued instructions for use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.