Multiple Indexes in same Solr Core..?

后端 未结 2 1293
傲寒
傲寒 2021-01-06 11:33

I am using Apache Solr..I have the following Scenario.. :

I have Two table in my PostGreSQL database. One is \"Cars\". Other is \"D

相关标签:
2条回答
  • 2021-01-06 12:07

    if the fields are the same for both cars and dealers, you could use one index with an object defined like so:

    <fields>
      <field name="id" type="string"   indexed="true" stored="true"/>
      <field name="name" type="name"  indexed="true" stored="true" />
      <field name="extra" type="extra"  indexed="true" stored="true" /> 
      <field name="description_text" type="text_general" indexed="true" stored="true" multiValued="true"/>
      <field name="type" type="string" indexed="true" stored="true" />
    </fields>
    

    this will work for both cars and dealers (so you don't need to have 2 indexes) and you'll use the "type" field to sort out if you want a "dealer" or a "car" (i'm using the same system to filter out similar types of objects with only a minor "semanthical" difference)

    also you'll need to add stored="true" to the fields you want to retrieve, or you'll be only able to use them for searching (hence that index="true")

    0 讨论(0)
  • 2021-01-06 12:18

    Adding a default value to the type field will ensure the type value being set to cars|dealer.

    You will have to index the sources separately. Then use copy field and you can easily filter on either cars|dealer.

    This does seem a bit tricky and is not explained well in the muti-indexes link referred to above.

    0 讨论(0)
提交回复
热议问题