现在我知道这是一个非常广泛的问题,这就是为什么我期待一个广泛的答案。我只是想朝着正确的方向转向。 简而言之,我打算创建一个网站,用户可以在其网站中包含特定数据,并与已输入相应数据的其他用户进行匹配,以创建“匹配”。 类似于基于最佳“化学”匹配用户的约会网站。然而,这甚至比这更简单。我在NetBeans中拥有编码经验,并且不断扩展我对网站开发的知识。
例如:
101, 102 and 103 = MATCH
User A - Data [User lists they have 101]
User B - Data [User lists they have 102 and 103]
用户A或B使用“查找完成您的设置的用户”,表或列列出完成此设置的用户。
所以,如果有人能够至少指出我正确的方向,那将非常感激!我在Webs.com上创建了几个网站,但我不相信他们的工具有类似的东西来填补这个需求。我打算使用Java(可能使用NetBeans)对该匹配系统进行编程,并在网站中实现。谢谢你们!
答案 0 :(得分:0)
您可能希望使用数据库来存储您的用户以及可以完成以匹配的所有可能的属性集。这是使用PostgreSQL创建这样一个数据库的一种方法:
create table person (
id int primary key,
first_name text not null,
attributes text[]
);
create table match (
id int primary key,
attributes text[]
);
insert into person values (1, 'Bob', array['A']);
insert into person values (2, 'Alice', array['B','D']);
insert into person values (3, 'Carol', array['B','C']);
insert into person values (4, 'Ted', array['D']);
insert into match values (1, array['A','B','D']);
我使用数组而不是连接表来减少冗长。现在,您可以通过运行以下查询找到所有完成Alice集#1的人员:
select
id,
first_name
from
(select
p2.id as id,
p2.first_name as first_name,
array(
select unnest(p1.attributes) union select unnest(p2.attributes)
) as match_potential
from
person p1
inner join person p2 on (p1.id = 2 and p2.id <> 2)) as p
where
p.match_potential @> (select attributes from match where id = 1);
鲍勃和爱丽丝现在是一场比赛。
最后你需要做一些更复杂的事情,但是这样的事情应该让你开始在你的网站上开始,并允许你建立你可以用来测试你的概念的第一个原型。