User Tools

Site Tools

Translations of this page:


Documentation index


Update 1


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 “group_name” from GET (url parameters). (http://domain/?group_name=test - so output all search queries with “test” )

<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 ((/admin/?operation=rotation&sub=rot_tube&subsub=rot_search_log&) )

For example, at на 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, hits, items_found FROM rot_search_queries WHERE hits > 0  GROUP BY search_query

	sql_attr_uint		    = hits
	sql_attr_uint		    = items_found


index search_queries_index
	source					= search_queries
	path					= /path_where_to_store_index
	docinfo					= extern
	morphology              = stem_en

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 &search_query_limit

Let's say surfers made following queries


if we'd use just <thumb search_log=all we'd get


but let's say we want to output at teen page only those request that where made at teen page


now we can do

<thumb search_log=all num=1-20 search_query_limit=teen>  

and get just


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>  (domain/?your_param=teen)

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


let's add in index template

<thumb search_log=all num=1-20 search_query_limit=GET_your_param>

and open page like domain/?your_param=lng_en, we should get

tcms_update_1.txt · Last modified: 2017/07/12 10:00 by admin