View Single Post
  #12 (permalink)  
Old 09-02-2007, 11:37 AM
kgun's Avatar
kgun kgun is offline
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 4,696
kgun RepRank 3kgun RepRank 3
Default Re: free internal site search code ?

If there is something called a web 2.0 site search engine / function, that is especially well suited for XML and its family of techologies and XML parsers. There should be no problem for a clever programmer that knows:
  1. XML XPath XPointer and XLink
  2. PHP or another server side language with good XML Parsers.
  3. AJAX.
to build a fairly advanced site search engine with Google suggest functionality. May be there are one already.

You find more information in my Web 2.0 static link collection of resources. Especially the links with anchor text:
  • Improving Web linking using XLink.
  • XML linking language.
These technologies make it possible to have dynamic and generic links, multi-source, multi-destination links and much much more. Using link bases, location sets, archs and assiciations between these sets in your XML documents, the search engine may be fairly advanced and flexible.

Here is a link base example:

"Example: Annotating a Specification

Following is a non-normative set of declarations for an extended link that specializes in providing linkbase arcs:

Code:
<!ELEMENT basesloaded ((startrsrc|linkbase|load)*)>
<!ATTLIST basesloaded  xlink:type      (extended)      #FIXED "extended">
<!ELEMENT startrsrc EMPTY>
<!ATTLIST startrsrc  xlink:type      (locator)       #FIXED "locator"  xlink:href      CDATA           #REQUIRED  xlink:label     NMTOKEN         #IMPLIED>
<!ELEMENT linkbase EMPTY>
<!ATTLIST linkbase  xlink:type      (locator)       #FIXED "locator"  xlink:href      CDATA           #REQUIRED  xlink:label     NMTOKEN         #IMPLIED>
<!ELEMENT load EMPTY>
<!ATTLIST load  xlink:type      (arc)           #FIXED "arc"  xlink:arcrole   CDATA           #FIXED "http://www.w3.org/1999/xlink/properties/linkbase"  xlink:actuate   (onLoad                  |onRequest                  |other                  |none)          #IMPLIED  xlink:from      NMTOKEN         #IMPLIED  xlink:to        NMTOKEN         #IMPLIED>
Following is how an XML element using these declarations might look. This would indicate that when a specification document is loaded, a linkbase full of annotations to it should automatically be loaded as well, possibly necessitating re-rendering of the entire specification document to reveal any regions within it that serve as starting resources in the links found in the linkbase.

Code:
<basesloaded>
 <startrsrc xlink:label="spec" xlink:href="spec.xml" /> 
 <linkbase xlink:label="linkbase" xlink:href="linkbase.xml" /> 
 <load xlink:from="spec" xlink:to="linkbase" actuate="onLoad" />
</basesloaded>
Following is how an XML element using these declarations might look if the linkbase loading were on request. This time, the starting resource consists of the words "Click here to reveal annotations." If the starting resource were the entire document as in the example above, a reasonable behavior for allowing a user to actuate traversal would be a confirmation dialog box".

Code:
<basesloaded>  
<startrsrc    xlink:label="spec"    xlink:href="spec.xml#string-range(//*,'Click here to reveal annotations.')" /> 
 <linkbase xlink:label="linkbase" xlink:href="linkbase.xml" />  
<load xlink:from="spec" xlink:to="linkbase" actuate="onRequest" />
</basesloaded>
Source: ML Linking Language (XLink) Version 1.0

For those that only know HTML, there should be nothing revolutionary in the above markup. The difficult part is to learn the new markup languages and the important concept of XML name spaces that you use to bind different resources. Note that Internationalized Resource Identifiers (IRIs) is a generalization of an URI that is an generalization of an URL.

So to sum up. To make a very efficient Web 2.0 XML powered site search engine with AJAX functionality (like Google suggest) the technology is there already. It is very important to think thoroughly when you structure your XML (CMS) site. Clever and smart use of tags, nodes, attributes, link bases and location sets etc. etc. may make your site search engine stand out. If you take the time to write one based on the above ideas, please cite this source and give me an example for free. Google suggest (AJAX) functionality will be much appreciated. Preferrably, use PHP paresers to make the code compact. Use streaming parsers like XMLReader to make it efficient.

Last edited by kgun : 09-02-2007 at 11:43 AM.
Reply With Quote