export query log

User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

export query log

Post by mark »

Not sure what you want. Could you elaborate?
Perhaps <sandr> and initcap() would be of use.
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

export query log

Post 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.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

export query log

Post by mark »

KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

export query log

Post 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.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

export query log

Post 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"
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

export query log

Post 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"
Post Reply