lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy <>
Subject schema design question: OR query over 2 fields or on a multivalued field?
Date Sat, 26 Dec 2009 10:37:22 GMT
I have documents that represent Companies. Each company has a field "Internet" which is a boolean
field, True means the company is an Internet company. There's also another field "location"
which is the city the company is located in, eg. "Austin" or "Houston".

A company can be both an Internet company and have a physical location. Or it can be an Internet-only
company, or it can be a brick-and-mortar only company.

I want to search companies based on (in addition to other criteria) whether it is an Internet
company or its physical location. So an example query "Look for companies that are Internet
companies OR are located in Austin" 

I can keep the 2 separate fields and construct queries using the OR operator. In this case
the example query above would be expressed as: "Look for companies that have the value True
in the Internet field and the value Austin in the location field"

Or I can combine the 2 fields into 1 by having a multivalued field, call it "combo". A company
that is both an Internet company and has a physical presence in Austin will have the values
"Internet" and "Austin" in the combo field. And the example query above would become: "Look
for companies that have the value "Internet" OR "Austin" in the combo field.

Does it matter whether I have 2 separate fields or 1 multivalued fields? Does it make any
difference in terms of performance or any other considerations?



View raw message