Discussion:
hit hightlighting wint asp.net
(too old to reply)
savvas stampolloglou
2007-02-13 19:34:24 UTC
Permalink
I am creating a search engine with asp.net but until now i haven't
found a working solution
for using the hit highlighter.
Has anyone managed to do it until now?
And if possible if you can give any examlpe


Thanks in advance!
Gang_Warily
2007-02-19 11:35:00 UTC
Permalink
Hi

I think ASP.net may not affect the hit highlighter.
It is accessed by putting parameters in the URL address.

http://msdn2.microsoft.com/en-us/library/ms692928.aspx
is the documentation for webhits.dll, with examples ...
Post by savvas stampolloglou
I am creating a search engine with asp.net but until now i haven't
found a working solution
for using the hit highlighter.
Has anyone managed to do it until now?
And if possible if you can give any examlpe
Thanks in advance!
Fred Kogel
2007-02-20 15:18:01 UTC
Permalink
Post by Gang_Warily
Hi
I think ASP.net may not affect the hit highlighter.
It is accessed by putting parameters in the URL address.
http://msdn2.microsoft.com/en-us/library/ms692928.aspx
is the documentation for webhits.dll, with examples ...
Post by savvas stampolloglou
I am creating a search engine with asp.net but until now i haven't
found a working solution
for using the hit highlighter.
Has anyone managed to do it until now?
And if possible if you can give any examlpe
Thanks in advance!
don't use the highlighter, built your own one ...

1) Define a new CSS-Class which makes the text highlighted (i.e. yellow
background)
2) Write a function to change your search-results ...
3) in your results HTML-Code let the function enlose your search-phrase
with your new CSS-tag

works fine, is fast & short
regards
Fred (from Germany)



THE FUNCTION:
Function Highlight(Search_Str as String, InputTxt as String, StartTag as
String, EndTag as String) As String

Return Regex.Replace(InputTxt, "(" & Regex.Escape(Search_Str) & ")",
StartTag & "$1" & EndTag, RegExOptions.IgnoreCase)

End Function

THE FUNCTION CALL:
MyHigLightedHTMLCode = Highlight(MySearchString, MyHTMLCode, "<span
class=highlight>", "</span>")
Hilary Cotter
2007-02-20 16:35:24 UTC
Permalink
One slight problem - this doesn't work with freetext.
--
Hilary Cotter

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
Post by Fred Kogel
Post by Gang_Warily
Hi
I think ASP.net may not affect the hit highlighter.
It is accessed by putting parameters in the URL address.
http://msdn2.microsoft.com/en-us/library/ms692928.aspx
is the documentation for webhits.dll, with examples ...
Post by savvas stampolloglou
I am creating a search engine with asp.net but until now i haven't
found a working solution
for using the hit highlighter.
Has anyone managed to do it until now?
And if possible if you can give any examlpe
Thanks in advance!
don't use the highlighter, built your own one ...
1) Define a new CSS-Class which makes the text highlighted (i.e. yellow
background)
2) Write a function to change your search-results ...
3) in your results HTML-Code let the function enlose your search-phrase
with your new CSS-tag
works fine, is fast & short
regards
Fred (from Germany)
Function Highlight(Search_Str as String, InputTxt as String, StartTag as
String, EndTag as String) As String
Return Regex.Replace(InputTxt, "(" & Regex.Escape(Search_Str) & ")",
StartTag & "$1" & EndTag, RegExOptions.IgnoreCase)
End Function
MyHigLightedHTMLCode = Highlight(MySearchString, MyHTMLCode, "<span
class=highlight>", "</span>")
Fred Kogel
2007-02-21 10:07:09 UTC
Permalink
Post by Hilary Cotter
One slight problem - this doesn't work with freetext.
why not (or maybe I did not understand)? The point is, that you highlight
the search phrase in the query's result(!).

If you use ASP.NET you should have and therefore control the result string
no matter what query-technique you use. Search & replace the search-phrase
and that's it.

We use it in different projects.

regards
Fred
Hilary Cotter
2007-02-22 00:18:08 UTC
Permalink
search on mouse with a freetext query and your content has mouse and mice in
it. How are you going to mark up mice?
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
Post by Fred Kogel
Post by Hilary Cotter
One slight problem - this doesn't work with freetext.
why not (or maybe I did not understand)? The point is, that you highlight
the search phrase in the query's result(!).
If you use ASP.NET you should have and therefore control the result string
no matter what query-technique you use. Search & replace the search-phrase
and that's it.
We use it in different projects.
regards
Fred
Fred Kogel
2007-02-22 19:37:39 UTC
Permalink
Post by Hilary Cotter
search on mouse with a freetext query and your content has mouse and
mice in it. How are you going to mark up mice?
thank you, I understand (and didn't understand before as I already feared).
Now it's evident that our 'technique' does only work with simpler animals
than mice ;-)

regards
fred

Loading...