$indexcount is higher than actual number of results

thomas.amsler
Posts: 18
Joined: Mon Nov 19, 2007 6:17 am

$indexcount is higher than actual number of results

Post by thomas.amsler »

I made some changes in the search script to adapt it to our needs. I mainly added some lines for the sql query to apply some filters in the function
<a name=collectlocalresults>

This filtering works as expected, but I am not able to find out why my $indexcount is not based on that. An example:
I search for the word "consciousness" which returns 2 results. But the $indexcount is 13 and thus my header says now "Results 1 - 2 of 13" and I have links to page 2 and 3 (we display 6 results per page). Of course these two pages are then empty as for the results my filter applies. I see that at the end of <a name=collectlocalresults> some calculation towards that $indexcount is done, but I don't get it why it has a higher number than actual results. It seems this variable is based on the plain query without my additional filter. Any hints, where I have to adapt some more in the search script?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

$indexcount is higher than actual number of results

Post by mark »

Yes, $indexcount is only an estimate based on the index used. See http://www.thunderstone.com/site/vortex ... count.html

You'll notice that the Webinator search script sets <$count=1> when also searching on aux data. You should do the same. That forces it to actually count every result instead of taking the index estimate.
thomas.amsler
Posts: 18
Joined: Mon Nov 19, 2007 6:17 am

$indexcount is higher than actual number of results

Post by thomas.amsler »

That brings up another question. It seems that if I change something in the search settings, it is not affected in the search script. I changed Proximity to something else than page, so <$count=1> should have been set, but nothing happened. But I did not change anything else than the collectlocalresults, summary and pageno functions (I'm returning an XML instead of the HTML). What could I have broken there?
thomas.amsler
Posts: 18
Joined: Mon Nov 19, 2007 6:17 am

$indexcount is higher than actual number of results

Post by thomas.amsler »

Same goes for the hits per page parameter. I wrote my needed value in the search script directly as I now did with <$count=1> with proximity set to page...
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

$indexcount is higher than actual number of results

Post by mark »

Try with the unmodified search script and see if it works where. If you don't have the original, you can always get the latest scripts from the Webinator support site.
thomas.amsler
Posts: 18
Joined: Mon Nov 19, 2007 6:17 am

$indexcount is higher than actual number of results

Post by thomas.amsler »

Just did that and I have the same problem, or does it have to be named "search" too make it work? I left the a copy of the original in the same folder and called it "search-v5-orig". I also modified the dowalk script, but just one small part of it to identify duplicates with one custom parameter. I doubt that I broke something there...
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

$indexcount is higher than actual number of results

Post by mark »

The name doesn't matter much as long as you're running the right one when testing. Is this a public url I can try?

After you set proximity to something other than page in the search settings. Go to search then click the advanced button. You should see your proximity setting there. Is it? If not and you set it on the advanced form does it then work as expected?
thomas.amsler
Posts: 18
Joined: Mon Nov 19, 2007 6:17 am

$indexcount is higher than actual number of results

Post by thomas.amsler »

Sorry, the webinator is not public accessible. Only the website that is using it. As I said, we modified quite a lot in the scripts and thus there is no advanced search option. Nevertheless the original script has the advanced options and there proximity is set to page but the search setting for that profile is on paragraph...

Anyway, I have another problem atm, as the search does not work correctly anymore. I often get the following message:
<!-- 115 /webinator/search:1970: Query '/lang1/' would require linear search -->
what does this mean?
I want to search for this string in the Url field...
thomas.amsler
Posts: 18
Joined: Mon Nov 19, 2007 6:17 am

$indexcount is higher than actual number of results

Post by thomas.amsler »

For better understanding the custom script part that causes problems atm:
<$sqlhelp="">
<!-- exclude index sitemap from results -->
<$sqlhelp=$sqlhelp " and Url not like '/searchsitemap'">
<$sqlhelp=$sqlhelp " and Url like '" $language "'">
<!-- if page has minisites (viewtree id in meta text) include them into the search -->
<if $minisites ne "">
<$sqlhelp=$sqlhelp " and (Url like '" $site "'">
<$minisitesplit=",">
<split ROW $minisitesplit $minisites>
<$sqlhelp=$sqlhelp " or Url like '/site" $ret "/'">
</split>
<$sqlhelp=$sqlhelp ")">
<else>
<if $site ne ""><$sqlhelp=$sqlhelp " and Url like '" $site "'"></if>
</if>
<if $lob ne ""><$sqlhelp=$sqlhelp " and Url like '" $lob "'"></if>

<$sql=$sql $sqlhelp>

$language, $site, $lob and $minisites are url parameters we send to webinator. The first three always have a leading and ending "/" to be able to distinguish between lang1 and lang10 in the like statement. $minisites is just a list of site ids and thus creating an or statement and adding the "/" manualy in the script...
thomas.amsler
Posts: 18
Joined: Mon Nov 19, 2007 6:17 am

$indexcount is higher than actual number of results

Post by thomas.amsler »

After searching the message board I found the statement <apicp allinear on> and put it just before the statement that caused this exception:
<sql skip=.....

But still I don't get it as some words e.g. "toys" were working but not "fumigation". But if you now search for fumigation on http://www.sgs.com you get the expected result (A service called fumigation) on top.
Post Reply