This shows you the differences between two versions of the page.
tcms_update_1 [2017/07/12 09:56] admin created |
tcms_update_1 [2017/07/12 10:00] (current) admin [Search query limit] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **Update 1** | ||
+ | ====== Rotation ====== | ||
+ | |||
+ | ===== Search Log Advanced Queries ===== | ||
+ | |||
+ | You can output last search queries as | ||
+ | |||
+ | <thumb num=1-10 search_log=all ... | ||
+ | | ||
+ | Now this tag became a bit more advanced. You can filter search queries by current group name for example. ie output all search queries that include parameter " | ||
+ | |||
+ | <thumb num=1-10 search_log=all filter=GET_group_name | ||
+ | <thumb num=1-10 search_log=all filter=GET_tag | ||
+ | <thumb num=1-10 search_log=all filter=GET_search | ||
+ | | ||
+ | and so on | ||
+ | |||
+ | By default search queries are sorted by amount of hits, but you can also sort by amount galleries found | ||
+ | |||
+ | <thumb num=1-10 search_log=all filter=GET_search order=items_found | ||
+ | <thumb num=1-10 search_log=all filter=GET_search order=hits | ||
+ | |||
+ | Search queries is a good way to add more pages, but it takes a lot of time to collect enough of them naturally. So you can add some in admin area ((/ | ||
+ | | ||
+ | For example, at на bigbase.smartcj.com about 2М search queries where added manually and we ran into 2 issues | ||
+ | |||
+ | 1. for some queries we had 0 results and it's not good. The script can check search queries from time to time and delete such queries (Recheck search queries log шт Rotation - Settings) or you can force this actionn in SSH | ||
+ | |||
+ | php rotation.php check_search_queries=true | ||
+ | |||
+ | 2. when you have a lot of queries filtering them using mysql becomes slow, so we can use sphinx here | ||
+ | |||
+ | < | ||
+ | |||
+ | source search_queries | ||
+ | { | ||
+ | type = mysql | ||
+ | |||
+ | sql_host = ........ | ||
+ | sql_user = ....... | ||
+ | sql_pass = ........ | ||
+ | sql_db = ...... | ||
+ | sql_port = 3306 # optional, default is 3306 | ||
+ | |||
+ | sql_query_pre = SET NAMES utf8 | ||
+ | |||
+ | sql_query = SELECT sq_id, search_query, | ||
+ | |||
+ | sql_attr_uint | ||
+ | sql_attr_uint | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | index search_queries_index | ||
+ | { | ||
+ | source = search_queries | ||
+ | path = / | ||
+ | docinfo = extern | ||
+ | morphology | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | Dont forget to add this index to Rotaion - Settings - Sphinx Search Log Index = search_queries_index | ||
+ | |||
+ | |||
+ | ===== Search query limit ===== | ||
+ | |||
+ | There a lot of ways to limit search results | ||
+ | |||
+ | /? | ||
+ | /? | ||
+ | /? | ||
+ | and so on | ||
+ | | ||
+ | that's why we introduced a new parameter | ||
+ | |||
+ | Let's say surfers made following queries | ||
+ | domain/? | ||
+ | domain/? | ||
+ | domain/? | ||
+ | domain/? | ||
+ | | ||
+ | |||
+ | if we'd use just <thumb search_log=all | ||
+ | |||
+ | test, | ||
+ | | ||
+ | but let's say we want to output at teen page only those request that where made at teen page | ||
+ | |||
+ | domain/? | ||
+ | domain/? | ||
+ | domain/? | ||
+ | domain/? | ||
+ | |||
+ | now we can do | ||
+ | |||
+ | <thumb search_log=all num=1-20 search_query_limit=teen> | ||
+ | |||
+ | and get just | ||
+ | |||
+ | test,test1 | ||
+ | | ||
+ | As usual you сan also get that parameter from URL for example | ||
+ | |||
+ | <thumb search_log=all num=1-20 search_query_limit=GET_your_param> | ||
+ | | ||
+ | another example, let's say you want to filter by language (in this example we have 2 languages EN and DE). We made following request | ||
+ | |||
+ | domain/? | ||
+ | domain/? | ||
+ | domain/? | ||
+ | domain/? | ||
+ | |||
+ | |||
+ | let's add in index template | ||
+ | |||
+ | <thumb search_log=all num=1-20 search_query_limit=GET_your_param> | ||
+ | | ||
+ | and open page like domain/? | ||
+ | |||
+ | test,test1 |