我正在编写一个流星应用程序,我需要一些建议,我该怎么做才能做到以下几点。我有一个名为Articles
的集合,它有报纸文章。我的想法是创建一个地图,其中每个关键点都指向一组在其中包含该词的文章。
例如:
/* Article 1 */
{
"_id" : "SB4mKAxaBijQXnS73",
"title" : "Messi signs new contract with Barcelona"
}
/* Article 2 */
{
"_id" : "rhqioBkePzGCrRFLp",
"title" : "Messi is from Argentina"
}
/* Article 3 */
{
"_id" : "X6LochRZw32op39W8",
"title" : "President of Argentina visits Messi"
}
然后我会:
Messi ==> [Article 1, Article 2, Article 3]
signs ==> [Article 1]
new ==> [Article 1]
contract ==> [Article 1]
with ==> [Article 1]
Barcelona ==> [Article 1, Article 3]
is ==> [Article 2]
from ==> [Article 2]
Argentina ==> [Article 2, Article 3]
President ==> [Article 3]
of ==> [Article 3]
visits ==> [Article 3]
然后我只需返回元组(键,数组),其中:
我的想法是迭代该数组并在模板中显示它,因此我需要在模板帮助器中执行它。