Page 3 of 3

export query log

Posted: Wed Oct 20, 2004 1:27 pm
by mark
Not sure what you want. Could you elaborate?
Perhaps <sandr> and initcap() would be of use.

export query log

Posted: Wed Oct 20, 2004 2:58 pm
by KMandalia
Yup, initcap it is.

What I wanted is when the search script adds the query in the querylog table it should remove the quotes and capitalize first letter of each word so that I can improve the accuracy of report I am generating every week.

Thanks. I don't think the initcap() reference is in the manual or may be I overlooked.

export query log

Posted: Wed Oct 20, 2004 3:21 pm
by mark

export query log

Posted: Thu Oct 21, 2004 11:17 am
by KMandalia
Two Questions:

1) In the function main in search script,

<sql novars "insert into querylog values(counter,$REMOTE_HOST,$qinfo,$query)"></sql>

right before this line, I want to take $query and remove quotes and apply initcap to it. I am having problems using sandr to remove quotes. Please give me a way so that I can remove Quotes from the query.

I am doing,

<if $query ne ""><!-- there was a query -->
<sandr "\"" $Query> (I AM DOING IT WRONG..., I WANT TO REMOVE QUOTES HERE)
<initcap $ret> (CHANGE TO INIT CAPS HERE)
<$query=$ret> (READY TO BE INSERTED IN QUERYLOG)

2) This is about querying querylog table. I want to get popular searches (We are promoting most pressing topics in our industry and different organization are trying it out as well)

The following is the sql statement I am using,

"select distinct Client, Query, count(distinct Query) No from querylog where Query not matches 'http%' group by Query Order By No"

the No. comes out to be all 1's. What I want to get is the number of how many different ip addresses are typing in the same search term.

Please help me rearrange this sql statement.

export query log

Posted: Thu Oct 21, 2004 12:14 pm
by mark
1)
<sandr '"' '' $query>
<$query=(initcap($ret))>

2)
"select Client,count(Client) No,Query from querylog where Info matches 'what=q%' group by Client order by No desc"

export query log

Posted: Thu Oct 21, 2004 12:20 pm
by mark
Maybe this is more what you wanted for 2.

"select count(distinct Client) No,Query from querylog where Info matches 'what=q%' group by Query order by No desc"