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 Panayiotis Papadopoulos <pa...@freemail.gr> on 2006/10/04 09:38:55 UTC

index different doc types

So Chris let 's assume i use the bundled example with jetty... I could 
clean up the index there is the example and start my own ...
In that case i just send different doc types and it is done ? Cos if 
remember well all docs have an <id> field or i can add an extra field 
like <researcher>y</researcher>,
<project>y</project> ...
So when i ll be doind my search i could just add ot my query 
/solr/project=y... or smth like that ?
Besides that i have to use the field id or i can rename to r_id and p_id 
and so on ???
If that works then i can use the bundled example as i can start it up 
easily and i could jetty instead of tomcat cos all i want from java is 
solr...

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.

Re: index different doc types

Posted by Yonik Seeley <yo...@apache.org>.
Documents can be "sparse".... not all documents need to have the same fields.

For Solr overwriting adds and delete-by-id functionality, you
currently need a single "id" field though.

If using a single id field could cause collisions (say if there is a
researcher id=1 and a project id=1), then simply put the type in the
id also.

So one way would be:

id:researcher_1
type:researcher
name:george
...

id:project_1
type:project
projname:fusion reactor
...

But sometimes flattening (denormalizing) the data is the best way to
go for a search engine.  You combine the related tables into a single
document schema like so:

id:1
name:fusion reactor
researcher: george
researcher: mark
researcher dan

Then it makes it straightforward to formulate queries like:
  - What projects does george work on:  q=researcher:george
  - What projects does george work on with fusion in the name:
q=+researcher:george +name:fusion
 - What are all the projects with reactor in the name: q=name:reactor
  - What projects do both dan and mark work on together:
q=+researcher:mark +researcher:dan

-Yonik

On 10/4/06, Panayiotis Papadopoulos <pa...@freemail.gr> wrote:
> So Chris let 's assume i use the bundled example with jetty... I could
> clean up the index there is the example and start my own ...
> In that case i just send different doc types and it is done ? Cos if
> remember well all docs have an <id> field or i can add an extra field
> like <researcher>y</researcher>,
> <project>y</project> ...
> So when i ll be doind my search i could just add ot my query
> /solr/project=y... or smth like that ?
> Besides that i have to use the field id or i can rename to r_id and p_id
> and so on ???
> If that works then i can use the bundled example as i can start it up
> easily and i could jetty instead of tomcat cos all i want from java is
> solr...
>