Is it possible to add custom metadata to a Lucene field? -


i've come point need store additional data particular field comes in lucene.net index. specifically, want attach guid fields of document when field added document, , retrieve again when document search result.

is possible?

edit: okay, let me clarify bit giving example.

let's have object want allow user tag custom tags "personal", "favorite", "some-project". adding multiple "tag" fields document, so:

doc.add( new field( "tag", "personal" ) ); doc.add( new field( "tag", "favorite" ) ); 

the problem need record meta data each individual tag itself, guid representing tag came (imagine user id). each tag potentially have different guid, can't create "tag-guid" field (unless order of values preserved---see edit 2 below). don't need metadata indexed (and in fact i'd prefer not be, avoid getting hits on metadata), need able retrieve again document/field.

doc.getfields( "tag" )[0].metadata... 

(i'm making syntax here, hope point clear now.)

edit 2: since different question, i've posted new question approach: is order of multi-valued fields in lucene stable?

okay let's try approach... key problem area indeterminacy of multiple field values under same field name (e.g. "tag"). if introduce or obtain kind of determinacy here, might able store metadata in field.

for example, if rely on order of values of field never changing, use index in set of values identify tag referring to.

is there guarantee order add values field remain same when retrieve document @ later time?

depending on search requirements index, may possible. way can control order of fields. require updating both fields tag list changes of course, overhead may worth it.

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

note: using {} allows qualify search uniqueness similar values exist.

example: if values stored "person|personal|personage" searching "person" return document has 1 of person, personal or personage. qualifying in curly brackets so: "{person}|{personal}|{personage}", can search "{person}" , sure won't return false positives. of course, assumes don't use curly brackets in values.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -