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 Kevin Grimes <ke...@me.com> on 2018/06/27 19:12:00 UTC

Storing documents with multiple equivalent field names

Hi all,

I have a unique situation that I’m not quite sure how to approach.

In my current Solr collection, I have documents that look like this:

{
“fieldA”: 1,
“fieldB”: 2,
“fieldC”: 3
}

We’re adding a new “type” of document, that looks like this:

{
“fieldD”: 1,
“fieldE”: 2,
“fieldF”: 3
}

The issue is, “fieldA” and “fieldD”, although they have different names, store the same sorts of values. In this example, the same is true for B & E, C & F.

I want to be able to search, for example, like this: “q=fieldA:1” and have it return both the first document and the second one, too, since fields A & D are equivalent, and they both store 1. However, I would also like to have a query for “q=fieldD:1” return the same response.

Is the best approach to solving this kind of problem to have a third field, for example, “fieldG”, and have “fieldA” and “fieldD” copy it? Or is there a cleaner solution?

Thanks,
Kevin Grimes