English 中文(简体)
Solr/Lucene:索引屬性值。
原标题:Solr/Lucene: Indexing facet values

例如,假设我有以下方面:

颜色 (yánsè)

  • Red (7825)
  • Orange (2343)
  • Green (843)
  • Blue (5412)

在我的数据库中,颜色将是一个表格,每个颜色将有一个主键和一个名称/值。

当使用Solr / Lucene进行索引时,在我看到的所有示例中,其值被索引而不是主键。因此,如果我按颜色红色进行过滤,我会得到以下内容:

http://www.example.com/search?color=Red 的翻译:

我在想,将主键索引化,当显示要素值时从数据库中检索数值,是否更明智?这样我可以获得类似以下的结果:

将此翻译为中文:http://www.example.com/search?color=1 http://www.example.com/search?color=1

“1”是指彩色红色的主要关键。 我很想知道,我是否应当采取这种做法,因为许多我方的价值观经常发生变化,但主要钥匙保持不变。 此外,该指数必须与数据库相提并论。

还有人有这方面的经验吗?你认为这会影响性能吗?

提前致谢!

最佳回答

如果您希望您的实体经常更改,那么最好索引ID,并且当您获取您的分面结果时,在数据库中进行查找以获取颜色名称。这样,颜色的更改不需要更新受影响的文档。

在我们的系统中,我们使用Lucene索引ID而不是实体名称,这正是您所述的原因。此外,我们的实体还有许多相关属性,这些属性并没有被索引,因此我们仍需要访问数据库才能获得它们。

就性能而言,ID的分面化不会明显变慢或变快。 就数据库查找而言,这不应该成为大问题,特别是如果您一次只拉下十个以上的方面。 如果这成为问题,您可以始终使用缓存来加快速度。

问题回答

暂无回答




相关问题
solr problem to get the field names

Ive got a problem. In each document I ve got fields: threads.id and posts.id. I want to get the field name value for them so i can get data from the database. Between the lines beneath i have marked ...

Which is the better client for Solr + PHP?

I have two options http://www.php.net/manual/en/book.solr.php http://code.google.com/p/solr-php-client/ I read it somewhere that that 2) use JSON as output types whereas 1) use XML doc. Isn t ...

Geronimo vs Glassfish

For a production environment, is Apache Geronimo better for applications that uses ActiveMQ, Derby, Solr?

Sort by date in Solr/Lucene performance problems

We have set up an Solr index containing 36 million documents (~1K-2K each) and we try to query a maximum of 100 documents matching a single simple keyword. This works pretty fast as we had hoped for. ...

SOLR - delta import not with last_modified

I saw only ways using delta import with last_modified. Is there some other ways to do delta_imports withut using timestamps? For example, if i have unique key(integer), can i tell SOLR to index only ...

SOLR How to return only limited matched content

ok guys, say in my Schema I have 4 fields: <field name="SiteIdentifier" type="string" indexed="true" stored="true" required="true"/> <field name="Title" type="text" indexed="true" stored="...

Solr - character substitution

I have Solr with indexed database. In my database all data is in Latvian. The problem is, I need to be able to search word Riga as if it is word Rīga. Of course, i can define synonym - Rīga = Riga, ...

热门标签