Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mission: customize summary results 1

Status
Not open for further replies.

simmerdown

Programmer
Jun 6, 2000
100
US
... which I hope is not the same thing as Mission: Impossible.

I've got a Verity search in place, and I can implement little tricks like returning only x number of characters from the "summary" result column. But what I'd really like to do is return results in this manner (assuming I've searched for "going" in this example):
_____________________________________

1. Getting Started
"... when David gets going on his search engine ..."

2. Debugging
"... in going through the code, I realized ..."

3. Rejoicing
"... we were just going out the door that night ..."
_____________________________________

The relevant sentence is featured in the result, with the searched-for term highlighted.
I've seen this type of contextual result here and there (google, for instance: ), on admittedly not-Verity-powered search engines. Any ideas on apporaching this functionality within a Verity result? Consider it a challenge ... I'll post any successes I have.
 
Just last week I was looking to do the same thing. After I read your post I thought I'd just sit down and pound out a custom tag to do it. This tag will work with boolean type queries and strip out any capitalized AND's, OR's, or NOT's. I also added the functionality to specify if it should only bold exact matches and if it should be case sensitive. Paste this code into a document and save it in your custom tag folder.

Call it like so:
<cf_BoolBold text=&quot;#QueryField#&quot; SearchTerm=&quot;#SearchTerm#&quot; Exact=&quot;Yes/No&quot; NoCase=&quot;Yes/No&quot;>

The tag:
<cfparam name=&quot;Attributes.SearchTerm&quot; default=&quot;&quot;>
<cfparam name=&quot;Attributes.Text&quot; default=&quot;&quot;>
<cfparam name=&quot;Attributes.Exact&quot; default=&quot;No&quot;>
<cfparam name=&quot;Attributes.NoCase&quot; default=&quot;No&quot;>

<cfset Attributes.SearchTerm = Trim(Attributes.SearchTerm)>
<cfset Variables.SearchText = Trim(Attributes.Text)>

<cfif Attributes.Exact>
<cfset SearchList = Attributes.SearchTerm>
<cfelse>
<cfset SearchList = &quot;&quot;>
<cfset Counter = 1>
<cfloop condition=&quot;Variables.Counter LTE Len(Attributes.SearchTerm)&quot;>
<cfset TermEnd = Find(&quot; &quot;,Attributes.SearchTerm,Variables.Counter)>
<cfif Variables.TermEnd EQ 0>
<cfset TermEnd = Len(Attributes.SearchTerm)>
<cfelse>
<cfset TermEnd = Variables.TermEnd - 1>
</cfif>
<cfset TermLength = Variables.TermEnd - Variables.Counter + 1>
<cfset SearchList = ListAppend(Variables.SearchList,Mid(Attributes.SearchTerm,Variables.Counter,Variables.TermLength),&quot;^&quot;)>
<cfset Counter = Variables.TermEnd + 2>
</cfloop>
</cfif>

<cfloop index=&quot;Variables.Term&quot; list=&quot;#Variables.SearchList#&quot; delimiters=&quot;^&quot;>
<cfset Counter = 1>
<cfloop condition=&quot;Variables.Counter LTE Len(Variables.SearchText)&quot;>
<cfset TermFind = &quot; &quot; & Variables.Term & &quot; &quot;>
<cfif Attributes.NoCase>
<cfset TermStart = FindNoCase(Variables.TermFind,Variables.SearchText,Variables.Counter)>
<cfelse>
<cfset TermStart = Find(Variables.TermFind,Variables.SearchText,Variables.Counter)>
</cfif>
<cfif Variables.TermStart EQ 0>
<cfbreak>
</cfif>
<cfset TermStart = Variables.TermStart + 1>
<cfset Variables.SearchText = Mid(Variables.SearchText,1,Evaluate(&quot;Variables.TermStart - 1&quot;)) & &quot;<b>&quot; & Mid(Variables.SearchText,Variables.TermStart,Len(Variables.Term)) & &quot;</b>&quot; & Mid(Variables.SearchText,Evaluate(&quot;Variables.TermStart + Len(Variables.Term)&quot;),Evaluate(&quot;Len(Variables.SearchText) - (Variables.TermStart + Len(Variables.Term)) + 1&quot;))>
<cfset Counter = Variables.TermStart + 1>
</cfloop>
</cfloop>

<cfset Caller.TextProcessed = Variables.SearchText>

This may be a little rough but it should do the trick. Let me know how it works out for you! Andrew
 
Hmm ... your custom tag gives me only &quot;search_term&quot; as an output rather than &quot;blah blah blah search_term blah blah&quot; That is, only the term I searched for is left in the string that is returned. Not exactly what I had in mind. Oh, and I'm using #TextProcessed# as the variable in the Display page ... I gather this is what you intended from &quot;Caller.TextProcessed&quot; in the tag file, yes? That was the only &quot;Caller.variable&quot; line I saw.

This is, however, my first time ever employing a custom tag, so bear with me as I get a handle on the concept. I'm working on understanding the flow of your tag right now, and may be able to figure out the necessary change. By the way [COLOR=003366]AMayer[/color], another post of yours on custom tags was very helpful too. Thank you thank you.
 
After you call the custom tag TextProcessed should contain all the text from where you said Text=&quot;blah, blah, Text to process, blah, blah&quot;. The words you set in SearchTerm should be bolded in TextProcessed. E-mail me if you like and I'll e-mail you the completed custom tag. It includes instructions and a few little improvements over the code I posted. amayer@sonic.net Andrew
 
Ah. I hadn't been clear on the employment of &quot;SearchTerm&quot; vs. &quot;Text&quot;.

Well, it's working for the most part now ... however, I've hit what may be our final limit. Verity formulates the #Summary# field on its own, selecting what it deems the best 500-character sample from every indexed page. Here's the rub: If my search term is within that summary paragraph, then I get the bolded term in the midst of the rest of the result. Very pretty! However, if that searched-for term is found in the indexed page but not in Verity's summary, then no bolding is seen and the user is not assured [as much] that this is a relevant page to their search.

Is there any way to get around Verity, so to speak, and pull more text from each indexed page than just the pittance of the #Summary# field?
 
Hi ..
And two years later someone came and asked the same question. What have you done about your summary results?

Thank you
-- Tareq

It's Nice to Be Important But It's more Important to BE Nice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top