开发者

Best practices for configuring a Solr schema

I'm currently configuring my schema.xml file and trying to figure out what's the best way to set up my documents. I use a RMDBS and thus many objects are relational.

Take this site for instance; a document typically consists of a question, followed by 0 or more answers. Say you'd want to set up fields for this, you would have to declare all question and answer fields in the same document, the way I see it. But given the fact that there can be more than one answer, you would have to create a document for each answer. So that means each question and each answer is stored in a separate document, which contains fields for both.

I don't see a diff开发者_StackOverflow中文版erent approach for this kind of problem, however I am relatively new to Solr and document DB's, so I may be wrong.

In short: what are the best practices if I would implement such a schema?


Another way to do it would be to have a question field and a multi-valued field for answers and have them in the same document. This is probably the best way to start unless you have specific requirements that favor the document-per-answer approach.

For example, if you needed to match individual answers as stand-alone search results, you may get better results and performance with the document-per-answer approach, as the "answer" documents will be scored, ranked and loaded in isolation.

But that would be an unconventional use of this type of data. Normally when you search a site like stack overflow, you are searching for a question and set of answers that cover a particular topic, so having everything in one document makes more sense.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜