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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:59:02+00:00 2026-05-20T07:59:02+00:00

I’ve come to the point where I need to store some additional data about

  • 0

I’ve come to the point where I need to store some additional data about where a particular field comes from in my Lucene.Net index. Specifically, I want to attach a guid to certain fields of a document when the field is added to the document, and retrieve it again when I get the document from a search result.

Is this possible?

Edit:
Okay, let me clarify a bit by giving an example.

Let’s say I have an object that I want to allow the user to tag with custom tags like “personal”, “favorite”, “some-project”. I do this by adding multiple “tag” fields to the document, like so:

doc.Add( new Field( "tag", "personal" ) );
doc.Add( new Field( "tag", "favorite" ) );

The problem is I now need to record some meta data about each individual tag itself, specifically a guid representing where that tag came from (imagine it as a user id). Each tag could potentially have a different guid, so I can’t simply create a “tag-guid” field (unless the order of the values is preserved—see edit 2 below). I don’t need this metadata to be indexed (and in fact I’d prefer it not to be, to avoid getting hits on metadata), I just need to be able to retrieve it again from the document/field.

doc.GetFields( "tag" )[0].Metadata...

(I’m making up syntax here, but I hope my point is clear now.)

Edit 2:
Since this is a completely different question, I’ve posted a new question for this approach: Is the order of multi-valued fields in Lucene stable?

Okay let’s try another approach… The key problem area is the indeterminacy of the multiple field values under the same field name (e.g. “tag”). If I could introduce or obtain some kind of determinacy here, I might be able to store the metadata in another field.

For example, if I could rely on the order of the values of the field never changing, I could use an index in the set of values to identify exactly which tag I am referring to.

Is there any guarantee that the order I add the values to a field will remain the same when I retrieve the document at a later time?

  • 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-20T07:59:03+00:00Added an answer on May 20, 2026 at 7:59 am

    Depending on your search requirements for this index, this may be possible. That way you can control the order of fields. It would require updating both fields as the tag list changes of course, but the overhead may be worth it.

    doc.Add(new Field("tags", "{personal}|{favorite}")); 
    doc.Add(new Field("tagsref", "{1234}|{12345}")); 
    

    Note: using the {} allows you to qualify your search for uniqueness where similar values exist.

    Example: If values were stored as “person|personal|personage” searching for “person” would return a document that has any one of person, personal or personage. By qualifying in curly brackets like so: “{person}|{personal}|{personage}”, I can search for “{person}” and be sure it won’t return false positives. Of course, this assumes you don’t use curly brackets in your values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I need to clean up various Word 'smart' characters in user input, including but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is

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.