You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by tkoomzaaskz <to...@gmail.com> on 2012/04/12 13:41:00 UTC

two structures in solr

Hi all,

I'm a solr newbie, so sorry if I do anything wrong ;)

I want to use SOLR not only for fast text search, but mainly to create a
very fast search engine for a high-traffic system (MySQL would not do the
job if the db grows too big).

I need to store *two big structures* in SOLR: projects and contractors.
Contractors will search for available projects and project owners will
search for contractors who would do it for them.

So far, I have found a solr tutorial for newbies
http://www.solrtutorial.com, where I found the schema file which defines the
data structure: http://www.solrtutorial.com/schema-xml.html. But my case is
that *I want to have two structures*. I guess running two parallel solr
instances is not the idea. I took a look at
http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/conf/schema.xml?view=markup
and I can see that the schema goes like:

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5">
  <types>
    ...
  </types>
    <fields>
      <field name="id" type="string" indexed="true" stored="true"
required="true" />
      <field name="sku" type="text_en_splitting_tight" indexed="true"
stored="true" omitNorms="true"/>
      <field name="name" type="text_general" indexed="true" stored="true"/>
      <field name="alphaNameSort" type="alphaOnlySort" indexed="true"
stored="false"/>
      ...
    </fields>
</schema>

But still, this is a single structure. And I need 2.

Great thanks in advance for any help. There are not many tutorials for SOLR
in the web.

--
View this message in context: http://lucene.472066.n3.nabble.com/two-structures-in-solr-tp3905143p3905143.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: two structures in solr

Posted by Chris Hostetter <ho...@fucit.org>.
: I need to store *two big structures* in SOLR: projects and contractors.
: Contractors will search for available projects and project owners will
: search for contractors who would do it for them.

http://wiki.apache.org/solr/MultipleIndexes

: that *I want to have two structures*. I guess running two parallel solr
: instances is not the idea. I took a look at

there's nothing wrong with it, the real question is wether you ever need 
to do things with both sets of documents at once.

if contractors only ever search for projects, and project owners only ever 
serach for contractors, and no one ever searches for a mix of projects and 
contractors at the same time, then i would just suggest using multiple 
SolrCores...

http://wiki.apache.org/solr/MultipleIndexes#MultiCore
http://wiki.apache.org/solr/CoreAdmin


-Hoss

Re: two structures in solr

Posted by Erick Erickson <er...@gmail.com>.
bq: Is that right?

I don't know, does it work <G>? You'll probably want an
additional field for unique id (just named "id" in the example)
that should be disjoint between your types.

Best
Erick

On Fri, Apr 13, 2012 at 3:41 AM, tkoomzaaskz <to...@gmail.com> wrote:
> Thank you very much Erick for your reply!
>
> So should it go something like the following:
>
> http://lucene.472066.n3.nabble.com/file/n3907393/solr_index.png
> sorry for an ugly drawing ;)
>
> In this example, the index will have 13 columns: 6 for project, 6 for
> contractor and one to define the type. Is that right?
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/two-structures-in-solr-tp3905143p3907393.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: two structures in solr

Posted by tkoomzaaskz <to...@gmail.com>.
Thank you very much Erick for your reply!

So should it go something like the following:

http://lucene.472066.n3.nabble.com/file/n3907393/solr_index.png 
sorry for an ugly drawing ;)

In this example, the index will have 13 columns: 6 for project, 6 for
contractor and one to define the type. Is that right?

--
View this message in context: http://lucene.472066.n3.nabble.com/two-structures-in-solr-tp3905143p3907393.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: two structures in solr

Posted by Erick Erickson <er...@gmail.com>.
You have to take off your DB hat when using Solr <G>...

There is no problem at all having documents in the
same index that are of different types. There is no
penalty for field definitions that aren't used. That is, you
can easily have two different types of documents in the
same index.

It's all about simply populating the two types of documents
with different fields. in your case, I suspect you'll have a
"type" field with two valid values, "project" and "contractor"
or some such. Then just attach a filter query depending on
what you want, i.e. &fq=type:project or &fq=type:contractor
and your searches will be restricted to the proper documents.

Best
Erick

On Thu, Apr 12, 2012 at 5:41 AM, tkoomzaaskz <to...@gmail.com> wrote:
> Hi all,
>
> I'm a solr newbie, so sorry if I do anything wrong ;)
>
> I want to use SOLR not only for fast text search, but mainly to create a
> very fast search engine for a high-traffic system (MySQL would not do the
> job if the db grows too big).
>
> I need to store *two big structures* in SOLR: projects and contractors.
> Contractors will search for available projects and project owners will
> search for contractors who would do it for them.
>
> So far, I have found a solr tutorial for newbies
> http://www.solrtutorial.com, where I found the schema file which defines the
> data structure: http://www.solrtutorial.com/schema-xml.html. But my case is
> that *I want to have two structures*. I guess running two parallel solr
> instances is not the idea. I took a look at
> http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/conf/schema.xml?view=markup
> and I can see that the schema goes like:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="example" version="1.5">
>  <types>
>    ...
>  </types>
>    <fields>
>      <field name="id" type="string" indexed="true" stored="true"
> required="true" />
>      <field name="sku" type="text_en_splitting_tight" indexed="true"
> stored="true" omitNorms="true"/>
>      <field name="name" type="text_general" indexed="true" stored="true"/>
>      <field name="alphaNameSort" type="alphaOnlySort" indexed="true"
> stored="false"/>
>      ...
>    </fields>
> </schema>
>
> But still, this is a single structure. And I need 2.
>
> Great thanks in advance for any help. There are not many tutorials for SOLR
> in the web.
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/two-structures-in-solr-tp3905143p3905143.html
> Sent from the Solr - User mailing list archive at Nabble.com.