PHP根据mysql进行盘点,根据用户完成的搜索对搜索条件记录进行计数(MYSQL PHP)...

I have a search form which provides searching properties for holiday in a specific country based on it's availability specific date. Search section has 2 sections "basic search" & "advance search".

Basic search contains country dropdown and date field. In advance search we have multiple filters for hotels like "Bedrooms" (1 bedroom, 2 bedroom etc) and then property type (apartment, villa, etc)

I want to show the search filter options with a count such as "1 bedroom (23 properties)" and same for other search filter options.

I am using php/mysql to create this application, so what comes first in my mind is to run multiple queries for all search filters and get the COUNT result from mysql and show it. I have about 10-12 different filters on my page. Also I have to show count records dynamically based on all search options (basic and advanced) selected.

Running multiple queries on the page will make it load forever and it will not show content due to multiple query load. Is there any better & faster way to do this?

Please help, thanks!

解决方案

What you're trying to achieve is called faceted search.

This isn't a problem suited to a relational database like MySQL.

Just remember that these are search servers and don't replace your main database. They only perform search operations that return the IDs that correspond to the actual records stored in your database. You still need MySQL (or MongoDB etc).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值