Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6582375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:16:19+00:00 2026-05-25T16:16:19+00:00

I am trying to design a schema for a scenarios where there is a

  • 0

I am trying to design a schema for a scenarios where there is a Many to Many relation between Products and Supplier. Search can be done from product centric way or supplier centric way. A product can be supplied by many Supplier and Supplier will have many product. Following is the solution I am thinking, but it seems like there is lot of redundancy in field definitions, do I need 2 entity definitions to support Product or Supplier centric searches. Does not look optimum.

When doing a search for a Supplier, “product” can be defined “multiValue=true” When doing a search for a product, “supplier” can be defined “multiValue=true”

<!-- Field definitions to support supplier search -->
<field name="s_supplier" type="string" indexed="true" stored="true" >
<field name="s_product"  type="string" indexed="true" stored="true" multiValue="true">

<!-- Field definition to support product search -->
<field name="p_product"  type="string" indexed="true" stored="true" >
<field name="p_supplier"  type="string" indexed="true" stored="true" multiValue="true">

entity definition in datahandler is

<entity name="products" ....>
   <field name="p_product" column="">
   <entity name="suppliers">
      <field name="p_supplier">
    </entity>
</entity>

<entity name="suppliers" ....>
   <field name="s_supplier" column="">
   <entity name="products">
      <field name="s_product" column="">
    </entity>
</entity>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:16:20+00:00Added an answer on May 25, 2026 at 4:16 pm

    The beauty of the Solr search engine is that you can just pick one schema definition, either product or supplier centric and then leverage the power of Solr to achieve your desired results. Let’s say that you go with a product centric one, using the following:

    <field name="product" type="string" indexed="true" stored="true" > 
    <field name="supplier" type="string" indexed="true" stored="true" multiValue="true">
    

    You can now search for products just by running a query against the product field product:my product and then if you want to search for a specific supplier, you can just use supplier:my supplier and because the supplier field is a multivalued field associated with each product, you will get all the products back where that supplier is associated.

    Another option for greater flexibility would be to leverage the text field that is defined in the example schema.xml file and use the 'copyfield function to copy both supplier and product values to one field and you can then search it for either and will get all documents returned that match the query term on either the supplier or product field.

    Here is an example, still using the fields defined above.

    <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
    <copyField source="product" dest="text" />
    <copyField source="supplier" dest="text" />
    

    Then if you search for text:my term it can be either product or supplier and all documents in the index that match that field will be returned. Please note that the text field has specific index and query time analyzers applied to it, so you should be aware of what is being applied.

    Also, if you need to produce a list of unique suppliers, you can leverage Solr Faceting to get that list from all of the documents in the index or only related to the current search criteria.

    Please see some of the following references for more details on these topics:

    • Analyzer, Tokenizers and Token Filters
    • Schema
    • Faceting Overview
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to design a schema where the columns of a table are
I'm new to MongoDB and am trying to design a simple schema for a
I am trying to design an efficient database schema for user settings in SQL
I am trying to design a schema for location attribute in my rails application.
So I've done my Object Oriented design, put together a database schema to go
I am trying to make the jump from data-centric design and development into DDD
I created one simple table design, I am trying to give space between column
I've been trying to design a database schema for a side project but I
I'm working on multi-lang website. Trying to design optimal db schema for this purpose.
I'm trying to design a SQL schema to represent a folder structure for e-mail,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.