How to count the number of hits in each abstract

Post Reply
rjshelq77
Posts: 3
Joined: Mon May 13, 2024 10:52 pm

How to count the number of hits in each abstract

Post by rjshelq77 »

Hi,

I've recently set up Webinator 27 and am using result profile 2. I would like to display a count of the number of hits which have been found each abstract. That is, I want to display the number of highlighted words which would appear in the document preview.

Any clues about how to get the count of the number of hits in each abstract, will be greatly appreciated. (the Webinator 27 search script is bewilderingly different than my old version 6.1)

Just to further clarify what I'm after, here's a snippet of my old search script, with my alterations to the old original webinator 6.1 script surrounded by comments with the initials RJS. The result that I'm after is called $dnumhits in this snippet:

<!-- ============================== -->
<!-- set up the abstract -->
<switch $SSc_abstractstyle>
<case desc>
<$dabstract=$Description>
<case smart>
<abstract $Body $SSc_abstractlen smart><$dabstract=$ret>
<case dumb>
<abstract $Body $SSc_abstractlen dumb><$dabstract=$ret>
<default><!--<case query>-->
<strfmt $qsrchfmt $txtquery>

<!-- RJS added -->
<$cleanQuery=$ret>
<!-- RJS end addition -->

<abstract $Body $SSc_abstractlen smart $ret><$dabstract=$ret>

<!-- RJS added dnumhits to count the number of hits in the abstract -->
<strfmt "%mbs" $cleanQuery $Body>
<rex row "<b>" $ret></rex>
<$dnumhits=$loop>
<!-- RJS end addition -->

</switch>
User avatar
John
Site Admin
Posts: 2599
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Re: How to count the number of hits in each abstract

Post by John »

The code now selects the Abstract directly from the database, and you can do the same with dnum.

You should see code like:

Code: Select all

   <$resultVars = $resultVars "Abstract">
   <makeAbstractSqlExpression>
   <$resultVarExps = $resultVarExps $ret>
that selects the Abstract.

After that you would want something like:

Code: Select all

<$resultVars = $resultVars "dnumhits">
<strfmt $qsrchfmt $txtquery>
<queryfixup var=$ret>
<$cleanMMQuery=$ret>
<$resultVarExps = $resultVarsExps "mminfo ($$cleanMMQuery,Body, 0,0, 6) - '203 hits: '">
I haven't actually tested the code in the script, but the SQL expression works, and should return the dnumhits variable.
John Turnbull
Thunderstone Software
rjshelq77
Posts: 3
Joined: Mon May 13, 2024 10:52 pm

Re: How to count the number of hits in each abstract

Post by rjshelq77 »

Thank you for your kind reply John, but perhaps I am too dense to figure out how to use the clues which you have provided.

As a starting point, I put the code which you suggested immediately after the lines you said to search for, and the vortex log says:

/webinator/search_rjs2:8687: Field `dnumhits' non-existent
/webinator/search_rjs2:8687: Field non-existent or type error in `dnumhits'
/webinator/search_rjs2:8687: SQLExecute() failed with -1: An error occurred in the function execntexis
User avatar
John
Site Admin
Posts: 2599
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Re: How to count the number of hits in each abstract

Post by John »

I had a type in this line:

Code: Select all

<$resultVarExps = $resultVarsExps "mminfo ($$cleanMMQuery,Body, 0,0, 6) - '203 hits: '">
both variables should have been the same:

Code: Select all

<$resultVarExps = $resultVarExps "mminfo ($$cleanMMQuery,Body, 0,0, 6) - '203 hits: '">
John Turnbull
Thunderstone Software
Post Reply