Hello Otis,

thank you for your reply.

What I am trying to achieve is to index different tables with different
primary keys and different fields (basically different documents/entity).

Is it possible to create a data-config with different root
entities/documents and index/search everything transparently? Is the
attached data-config.xml valid?

If it is, is the attached schema.xml valid? The issue there is that I don't
know how to specify the corresponding uniquiKeyId.

Thanks a lot for your help.

Giovanni


On 3/18/09, Otis Gospodnetic <otis_gospodne...@yahoo.com> wrote:
>
>
> Giovanni,
>
> It sounds like you are after a JOIN between two indices a la RDBMS
> JOIN?  It's not possible with Solr, unless you want to do separate queries
> and manually join.  If you are talking about merging multiple indices of the
> same type into a single index, that's a different story and doable, although
> not yet via Solr.
>
> Otis
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>
>
> ----- Original Message ----
> > From: Giovanni De Stefano <giovanni.destef...@gmail.com>
> > To: solr-user@lucene.apache.org
> > Sent: Wednesday, March 18, 2009 12:56:36 PM
> > Subject: Solr multiple indexes
> >
> > Hello all,
> >
> > here I am with another question :-)
> >
> > I have to index the content of two different tables on an Oracle DB.
> >
> > When it comes to only one table, everything is fine: one datasource, one
> > document, one entity in data-config, one uniqueKey in schema.xml etc. It
> > works great.
> >
> > But now I have on the same DB (but it might be irrelevant), another table
> > with a different structure from the first one: I might merge the two
> table
> > to have a huge document but I don't like this solution (delta imports
> would
> > be a nightmare/impossible, I might have to index data from other sources
> > etc).
> >
> > I believe I should create MULTIPLE INDEXES and then merge them. I have
> found
> > very little documentations about this: any idea?
> >
> > The Multiple Solr Webapps solution seems nice, but how could I search
> > globally within all index at the same time?
> >
> > The current architecture already expects Multicore Solr (to serve
> different
> > countries) so I would rather not prefer to have multicore multicore
> Solr...
> > :-(
> >
> > Any help/link is very much appreciated!
> >
> > Cheers,
> > Giovanni
>
>
<dataConfig>
  <dataSource 
    driver="oracle.jdbc.driver.OracleDriver" 
    url="jdbc:oracle:thin:@localhost:1521/XE" 
    user="TEST" 
    password="TEST"
  />
  <document name="TEST">
    <entity 
        name="book" 
        pk="TITLE" 
        query="select TITLE,AUTHOR,PRICE,TIMESTAMP from BOOKS" 
        deltaQuery="select TITLE from BOOKS where TIMESTAMP > '${dataimporter.last_index_time}'"
        root="true"
    >
      <field column="TITLE" name="book_title"/>
      <field column="AUTHOR" name="book_author"/>
      <field column="PRICE" name="book_price"/>
      <field column="TIMESTAMP" name="book_timestamp"/>
    </entity>

    <entity
        name="furniture"
        pk="ID"
        query="select ID,COLOR,SIZE,TIMESTAMP from FURNITURE"
        deltaQuery="select ID from FURNITURE where TIMESTAMP > '${dataimporter.last_index_time}'"
        root="true"
    >
      <field column="ID" name="furniture_id"/>
      <field column="COLOR" name="furniture_color"/>
      <field column="SIZE" name="furniture_size"/>
      <field column="TIMESTAMP" name="furniture_timestamp"/>
    </entity>

  </document>
</dataConfig>
<?xml version="1.0" ?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<schema name="DIT" version="1.1">
  <types>
   <fieldType name="text" class="solr.TextField" positionIncrementGap="100"/>
   <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
  </types>

 <fields>   
  <!-- BOOKS -->
   <field name="book_title" type="text" indexed="true" stored="true" multivalued="false" required="true"/>
   <field name="book_author" type="text" indexed="true" stored="true" multivalued="false"/>
   <field name="book_price" type="text" indexed="true" stored="true" multivalued="false"/>
   <field name="book_timestamp" type="date" indexed="true" stored="true" multivalued="false"/>
   <field name="all_book" type="text" indexed="true" stored="true" multivalued="true"/>

  <!-- FURNITURE -->
   <field name="furniture_id" type="text" indexed="true" stored="true" multivalued="false" required="true"/>
   <field name="furniture_color" type="text" indexed="true" stored="true" multivalued="false"/>
   <field name="furniture_size" type="text" indexed="true" stored="true" multivalued="false"/>
   <field name="furniture_timestamp" type="date" indexed="true" stored="true" multivalued="false"/>
   <field name="all_furniture" type="text" indexed="true" stored="true" multivalued="true"/>

   <field name="all" type="text" indexed="true" stored="true" multivalued="true"/>

   <field name="primary_key" type="text" indexed="true" stored="true" multivalued="true"/>

  <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
 
 </fields>

 <uniqueKey>primary_key</uniqueKey>

 <defaultSearchField>all</defaultSearchField>

 <solrQueryParser defaultOperator="OR"/>

   <copyField source="book_title" dest="all_book"/>
   <copyField source="book_author" dest="all_book"/>
   <copyField source="book_price" dest="all_book"/>
   <copyField source="book_timestamp" dest="all_book"/>

   <copyField source="furniture_id" dest="all_furniture"/>
   <copyField source="furniture_color" dest="all_furniture"/>
   <copyField source="furniture_size" dest="all_furniture"/>
   <copyField source="furniture_timestamp" dest="all_furniture"/>
   
   <copyField source="all_book" dest="all"/>
   <copyField source="all_furniture" dest="all"/>

   <copyField source="book_title" dest="primary_key"/>
   <copyField source="furniture_id" dest="primary_key"/>

</schema>

Reply via email to