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 Daniel Shane <sh...@LEXUM.UMontreal.CA> on 2010/02/16 22:54:59 UTC

Merge several queries into one result?

Hi all!

I'm trying to join 2 indexes together to produce a final result using only Solr + Velocity Response Writer.

The problem is that each "hit" of the main index contains references to some common documents located in another index. For example, the hit could have a field that describes in what state its located. This field would have a value of "NY" for New York etc...

Now what if, in velocity, I want to show this information in full detail. Instead of the NY, I would like to show "New York"? This information has not been indexed in the main index, but rather in a second one.

Is it possible to coalesce or join these results together so that I can pass a simple Velocity template to generate the final HTML?

Or do I have to write a webapp in java to cache all these global variables (the state codes, the country codes etc...)?

Daniel Shane

Re: Merge several queries into one result?

Posted by Erick Erickson <er...@gmail.com>.
It's generally a bad idea to try to think of
various SOLR/Lucene indexes in a database-like
way, Lucene isn't built to do RDBMS-like stuff. The
first suggestion is usually to consider flattening
your data. That would be something like
adding NY and "New York" in each document.

If that's not possible, the thread titled "Collating results from multiple
indexes" might be useful, although my very quick
read of that is that you have to do some custom work...

HTH
Erick


On Tue, Feb 16, 2010 at 4:54 PM, Daniel Shane <sh...@lexum.umontreal.ca>wrote:

> Hi all!
>
> I'm trying to join 2 indexes together to produce a final result using only
> Solr + Velocity Response Writer.
>
> The problem is that each "hit" of the main index contains references to
> some common documents located in another index. For example, the hit could
> have a field that describes in what state its located. This field would have
> a value of "NY" for New York etc...
>
> Now what if, in velocity, I want to show this information in full detail.
> Instead of the NY, I would like to show "New York"? This information has not
> been indexed in the main index, but rather in a second one.
>
> Is it possible to coalesce or join these results together so that I can
> pass a simple Velocity template to generate the final HTML?
>
> Or do I have to write a webapp in java to cache all these global variables
> (the state codes, the country codes etc...)?
>
> Daniel Shane
>