Page 1 of 1

Results Highlighting

Posted: Mon Nov 19, 2001 3:56 pm
by source1Tamer
I'm trying to highlight the results returned from the SQL query, following is a snippet of my code:

<!---------------------------------------------------->
<fmtcp query "%mbH" $srchQuery>
<SQL ROW SKIP=$jump MAX=$recsperpage "select URL from sites">
<mm>$URL</mm>
<!---------------------------------------------------->

The variable $URL is only highlighted in the first loop, after that it's not....I don't know why
any clues??

Tamer
Source1Solutions

Results Highlighting

Posted: Mon Nov 19, 2001 4:56 pm
by Kai
What is your $srchQuery? What are some later values of $URL that are not being highlighted?

Results Highlighting

Posted: Mon Nov 19, 2001 5:11 pm
by source1Tamer
$srchQuery is the word that I'm looking for.
so let's say I'm looking for the word 'Auto',in a database field called URL, I'll do the following:
<!---------------------------------------------------->
<$srchQuery = 'Auto'>
<fmtcp query "%mbH" $srchQuery>
<SQL ROW SKIP=$jump MAX=$recsperpage "select URL from sites">
<mm>$URL</mm>
<!---------------------------------------------------->

I got the results as:
www.auto-clubs.net
www.autobuzz.com
www.autoclinic.net
www.automags.org
www.autometrix.co.uk

Only the word 'auto' in the first record was bold.
The wierd thing is when I try to search using a different word like 'help' I'm getting the bold highlight in a randum manner, for instance, the records 1,4,5 are bold but 2,3,6,7 are not !

I tried not to use the fmtcp function and instead, I've used the <sand> function, But I don't know how to format the characters to be diplayed in HTML, I got the results as:
www.parts<b>auto</b>.com (I couldn't replace the AscII characters with the HTML.)

Results Highlighting

Posted: Mon Nov 19, 2001 5:13 pm
by source1Tamer
Note: I mean <sandr>

Results Highlighting

Posted: Mon Nov 19, 2001 5:26 pm
by Kai
Query highlighting is just like a LIKE or LIKEP search in that a word will not be found as a substring of another word (except when using certain special pattern matchers), only as a distinct word itself, according to the Metamorph (<apicp>) settings currently in effect. If you use a wildcard after the word, eg. 'auto*', then it will match 'automobile', 'automags', etc.; just as LIKE/LIKEP would match.

To match 'auto' anywhere in a word, not just the start, use REX: '/auto'. (A slash introduces a REX expression; see the manual for Metamorph query syntax.) Note that REX has its own special characters; see the manual on REX syntax.

Results Highlighting

Posted: Mon Nov 19, 2001 5:46 pm
by mark
Also note that REX is linear. Search this board and/or the manual for allinear.

Results Highlighting

Posted: Tue Nov 20, 2001 9:35 am
by source1Tamer
Actually I just wanted to highlight a few characters out of expression, it should be simpler..
Fortuanetly, I used the function <sum> to construct the <b> and </b> tags around the required word, so instead of having 'Auto' it will be '<b>Auto</b>' , then I've used the <sandr> to replace the 'Auto' with the new '<b>Auto</b>' ,, then I have used the <send> function to print the string as is without HTML escapment. I'm rockin now...