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 6758209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:45:13+00:00 2026-05-26T13:45:13+00:00

Sorry for the lengthy text, it’s a bit difficult to explain: We are using

  • 0

Sorry for the lengthy text, it’s a bit difficult to explain:

We are using Solr to index some user info like username, email (among other things).

I’m also trying to use facets for search, so for example, I added a multi-value field to user called “organizations” where I would store the name of the organizations that user work for.

So i can use that field for facetted search and be able to filter a user search query result by the organizations this user work for.

So now, the issue I have is my code does something like:
1) Add users documents to Solr
2) When a user is assigned an organization membership(role), update the user doc to set the organizations field

Now I have the following issue with step 2:
If I just do a addField(“organizations”, “BigCorp”) on the user doc, it will add that value regardless if organizations already have that value(“BigCorp”) or not, but I want each org name to appear only once.

So only way I found to get that behavior is to query the user document, get the values of “organization” and only add the new value if it’s not already in there – if !userDoc.getValues(“organiations”).contains(value) {… add the value to the doc and save it …}-

Now that works well, but only if I commit all the time(between step 1 & 2 at least), because the document query will not work unless it has been committed already. Obviously in theory its best not to commit all the time performance-wise, and unpractical since I process those inserts in batches.

So I guess the main issue would be:

  • Is there a way to update a multi-value field, without allowing duplicates, that would not require querying the doc to manually prevent duplicates ?

  • Maybe some better way to do this ?

Thanks.

  • 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-26T13:45:13+00:00Added an answer on May 26, 2026 at 1:45 pm

    Couple of things –

    • For multiple duplicate values in the faceted field, the value in faceted field is counted just once. So even if you add multiple same values, that would be reflected as a single value in the facet count entry. Have tested this. you too can confirm.
    • Also, when you reindex the document why would you need to check whats in the existing document. As I presume you would have the unique list of organizations and when fed to Solr, the document would be deleted and inserted.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this sounds like a really stupid question, but I need to make
Sorry in advance for the lengthy explanation! I have a C++ application that uses
(EDIT: I've edited my question to make it simpler, sorry if some answers are
Bad wording on the question, sorry about that. Will try to explain what I'm
Sorry for the simple question but I feel like there's a smarter way to
Sorry for the basic question - I'm a .NET developer and don't have much
Sorry for this not being a real question, but Sometime back i remember seeing
Sorry, I'm new to SVN and I looked around a little for this. How
Sorry the title isn't more help. I have a database of media-file URLs that
Sorry for the second newbie question, I'm a developer not a sysadmin so this

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.