Solr add, update, delete indexes

 

solr-admin new index

1. Increase the weight (boost) in the doc tag and field tag. After the weight is increased, weight filtering can be performed during the search. This will be described in detail in the subsequent search chapters.

<add>
  <doc boost="2.5">
    <field name="employeeId">05991</field>
    <field name="office" boost="2.0">Bridgewater</field>
  </doc>
</add>

2.field label

update = "add" | "set" | "inc" Versions after 4.0 can automatically add and delete fields, please refer to http://wiki.apache.org/solr/Atomic_Updates


Add field example

 

<add>
  <doc>
    <field name="employeeId">05991</field>
    <field name="office" update="set">Walla Walla</field>
    <field name="skills" update="add">Python</field>
  </doc>
</add>

 

Example of multiple values ​​for the same field

 

<add>
  <doc>
    <field name="employeeId">05991</field>
    <field name="skills" update="set">Python</field>
    <field name="skills" update="set">Java</field>
    <field name="skills" update="set">Jython</field>
  </doc>
</add>

 

Example of clearing fields

<add>
  <doc>
    <field name="employeeId">05991</field>
    <field name="skills" update="set" null="true" />
  </doc>
</add> 

Adding an index in json format is similar to that of xml, just select json in Document Type.

{"id":"s10001","name":"江小白"}


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325250983&siteId=291194637