简体   繁体   English

如何将元数据添加到Lucene字段

[英]How to add metadata to a lucene field

During indexing of documents, I need to store some metadata to fields. 在对文档建立索引期间,我需要将一些元数据存储到字段中。

For example: 例如:

  1. I add the field new Field("myField", "myValue", ...) to the document 我将字段new Field("myField", "myValue", ...)到文档中
  2. Now I need to store some kind of metadata (like the type of 'myValue' type) to that field. 现在,我需要将某种元数据(例如“ myValue”类型的类型)存储到该字段。
  3. This metadata should be indexed as well and stored associated to that field, so searching by the value or the metadata should result in the same set of documents. 该元数据也应被索引并与该字段相关联地存储,因此按值或元数据进行搜索应得到相同的文档集。
  4. Querying all values of myField will return a list of all indexed values supplemented with that metadata. 查询myField所有值将返回以该元数据为补充的所有索引值的列表。

Is this possible at all? 这有可能吗? (May be I should better use some kind of database, but I have to use Lucene.) (也许我应该更好地使用某种数据库,但是我必须使用Lucene。)

Thanks in advance 提前致谢


Concrete Example: 具体示例:

I have SVG-documents (XML) 我有SVG文档(XML)

Any of that documents gets fields of type "component" with the values "X35" , "Z89" and many more 该文档中的任何一个都将获得类型为“ component”的字段,其值分别为"X35""Z89"

I need to store some metadata to "X35" , "Z89" and other: 我需要将一些元数据存储到"X35""Z89"和其他:

 X35 => description="My X35 component", sizeX=10, sizeY=20<br>
 Z89 => description="Z89 part", usage_note="...."<br>

and so on 等等

After doing some further research, I think, that it is not possible at all. 经过进一步的研究,我认为根本不可能。 I really should use a RDBMS ... ;) 我真的应该使用RDBMS ...;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM