dongmubi4375 2016-05-11 05:50
浏览 42

实施高级搜索的最佳方式是什么,例如“{{Entity1}} {{Action}} {{Entity2}}”

I've a site with following features group, events, pages and users.

Currently normal search on group name, event name, page name and user name are working even works on their description and posts.

But I want to implement some smart search like if someone searches :

"Robert from New York" - it will return all users from new york whose name is robert

"Artist from London" - it will return all users who writes artists in their profession and city is London

"Developer in Google" - it will return all users who works puts writes developer in their profession and google in comapny

"Groups for Entertainment" - it will return all groups which is under Entertainment category

I've sep. table for categories, cities, companies, groups, events, users, pages and actions.

I want best and fastest way to do something like this just suggest me some way which is good in performance and also extendable for example if any action increase in future then can be implemented easily without breaking previous.

Many thanks in advance :)

I've also planned to put 1 more table before search for this with fields : Name and Type, Name can be anything and Type will be something like : User, Skill, Designation, Company, city, Group

  • 写回答

1条回答 默认 最新

  • douanye8442 2016-05-11 06:06
    关注

    You can do this by search string.

    1. Search for " in "," from " and " for " first in string.(Need to have space so that, names do not conflict)
    2. Based on result of step 1, split your string to two part. For example, "Robert from New York" will be array("Robert","New York")
    3. Based on your step 1 and 2 look for respective tables for example, step 2 can have 1st value to be searched in designation(Artist) or Name(Robert) and second value will be in location.
    4. You will need to follow same for other scenarios.
    5. Build array of all possible outcomes in single array along with it's url like group will have group url and person will have profile url and on front-end simply loop your output.
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。