User Tools

Site Tools

Translations of this page:

Sidebar

Documentation index

tcms_update_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 “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 на 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, 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

/?search=... 
/?search=...&group_id=..
/?search=...&tag=..
and so on

that's why we introduced a new parameter &search_query_limit

Let's say surfers made following queries

domain/?search=test&group_name=teen
domain/?search=test1&group_name=teen
domain/?search=blabla&group_name=mature
domain/?search=blabla2&group_name=mature

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

test,test1,blabla,blabla2

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

domain/?search=test&group_name=teen&search_query_limit=teen
domain/?search=test1&group_name=teen&search_query_limit=teen
domain/?search=blabla&group_name=mature&search_query_limit=mature
domain/?search=blabla2&group_name=mature&search_query_limit=mature

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>  (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

domain/?search=test&force_lng=en&search_query_limit=lng_en
domain/?search=test1&force_lng=en&search_query_limit=lng_en
domain/?search=blabla&force_lng=de&search_query_limit=lng_de
domain/?search=blabla2&force_lng=de&search_query_limit=lng_de

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

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