问题标签 [related-content]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
344 浏览

php - 获取与视频 ID X 相关的视频

我正在尝试选择与视频 id X 相关的 6 个相关视频。我在 SO 上查看了几个问题,但没有一个与我的系统与流派等匹配。我试图做的是制作一个,UNION SELECT但是一遍又一遍地列出相同的视频,所以我放弃了。

我现在有三个数据库。

视频- 包含所有可用视频的表格。 vID vName vCover

流派- 包含可用流派(动作、戏剧、惊悚片等)的表 gID gName

Genre_connections - 此表包含流派和视频之间的连接(thriller -> inception(但带有它们的 ID)) gcID gcVideoID gcGenreID

我想选择 6 个与提供的 ID 相关的视频。关系基于相似的流派。因此,如果我正在查看恐怖/惊悚电影,最相关的视频将是恐怖/惊悚电影,第二大相关视频将是恐怖惊悚电影。

基本上,关系应该基于具有相同流派的电影,按共同的总流派排序,降序排列。

如果可以包含名称之间的关系也不会太麻烦。因此,如果我正在查看钢铁侠,最热门的相关视频将是钢铁侠 2钢铁侠 3,然后是与类型相关的电影。

0 投票
1 回答
63 浏览

html - 如何使用 html 表单发布关系数据

我有一个动态 html 表单,它使用 javascript 为某些产品创建新输入,并且每个产品都有更多颜色。

我如何创建此 html 代码,以便当我将它们放在帖子中时,我可以将它们与 for 关联起来。

0 投票
0 回答
59 浏览

php - 相关产品查询问题

嗨,我正在尝试制作相关产品盒,但无法按我的意愿工作。例如,我在 nokia asha 102 的页面上。然后我想输出相关产品 al nokia asha。表示查询仅检测 nokia asha 词,并在 nokia asha 之后删除所有词。我只想在字符串和其他句子修剪上保留前 2 个句子。当我尝试这样做时,如果 nokia asha 相关产品无法使用,那么我想选择其他产品但品牌相同。所以我在这里遇到了问题,因为它不能全部按品牌(不相关)或空显示或随机显示显示。在我的查询下方

那么我如何解决这个问题?

0 投票
1 回答
36 浏览

entity-framework - 如何获取集合属性具有列表任何元素的实体?

我有这个实体:

我想获取属性 lstEntitiesB 具有一个或多个 ID 位于 lstIDsEntitiesB 上的所有实体 A。

我不知道我是否必须使用连接或有任何其他方式,也许使用任何或包含。

非常感谢。

0 投票
1 回答
2019 浏览

python - Python/Django 迭代多对多相关字段

我需要一些帮助来解决一个问题。

我有三个模型,参考,关系和电路。关系是第一个的内联。电路和关系是相关的。我要做的是: - 我在参考 1 中,我在 Relation1 到 RelationN 中选择了一些电路。- 当我保存时,我需要将 Relation1 保存到 RelationN,以及其他必须包含该引用的其他关系中存在的所有电路的 RelationFirst(在保存参考模型时创建)。

我现在拥有的代码,谁不这样做,是:

有什么帮助吗?因为不能迭代ManyToManyRelatedField,也不知道怎么做。非常感谢!

0 投票
2 回答
2621 浏览

semantic-web - 是否有 API 可以获取类似于 Google 的“人们也在搜索”的结果?

我正在寻找一种 API,它可以为 Google 的“人们也搜索”功能提供类似的结果。因此,例如,当我搜索斯坦利·库布里克时,我会看到人们搜索的所有其他电影导演。

我知道Freebase API,但它只是提供有关搜索项的信息,而不是它可能与其他搜索项相关的信息。

Google AdWords API 中还有一个TargetingIdeaSelector工具,可以显示相关关键字,但这并没有真正从语义上确定结果范围。

最后,有一个非常简单的Bing API 可以显示相关搜索(也在此处),但同样,它没有语义范围内的信息。

您是否知道任何 API,或者 Google 的 API 中是否有类似的东西可以向我显示语义范围内的相关搜索?

0 投票
1 回答
32 浏览

php - 在页面上显示相关内容

任何我正在使用 Drupal 7,我正在尝试根据它们被标记的分类值匹配相关节点。我想在不使用视图或块的情况下实现这一点。所以我有两种内容类型。内容类型 1 是主页,内容类型 2 就像位于内容类型 1 文章上的右手块。

所以上面的插图演示了页面的外观。我的问题是:如何根据分类标记在 C1 上显示正确的 C2。因此,如果 C1 被标记为狗,我如何显示一个也被标记为狗的 C2?我知道这篇文章有点含糊。任何建议将不胜感激。

0 投票
1 回答
350 浏览

python - Get all models related to this model in django (via ForeignKey, ManyToMany)

I have to get all the models related to my current model. The relations can be by ForeignKey, ManyToManyField or OneToONeField, from this model or to this model.

For eg:

I have a model:

I need to find related models of the model MyModel, that means if I have a function get_related_models, get_related_models(MyModel) should return [AnotherModel,Type]

Note:The ultimate use of this is I need to invalidate cache of MyModel when ever there is any change in this model and its related models(By using some post_save).

0 投票
1 回答
1001 浏览

php - add related posts to single post wordpress template

i'm trying to show a module with the related products in a single post page.

I created a cpt called "Product", and a taxonomy called "category".

What i want to do is to show, in the single post page, the other products of the same category.

Until now i successfully add the other posts with the function wp_get_recent_post, but of course i get all posts.

how i can pass the class to query ?

this is my code :

thank you

Edit.

i solved this way:

0 投票
2 回答
750 浏览

ruby-on-rails - Get records order by count of related Many to Many association

Scnerio:

https://www.funtraker.com is listing movies, tv shows and games. On show page of each resource(Movie, Tv Show etc) we want to list down the related resources.

Schema:

Now I want to get a list of related movies based on matched genre( two movies are related if both has 'comedy` genre). And these related movies need to order by max number of matched genres.

Well here is sample movies and the expected output.

Hopefully question make sense.

UPDATE: Looking for SQL only solution. I don't need to cache the results in any another table.