Results 1 to 2 of 2

Thread: creating search engine

  1. #1
    Join Date
    Feb 2003

    creating search engine

    Guess I'm using "not a common" way for creating my web-site.
    I create a templete which is in .asp format, and all the content is in .inc format (except some in .asp).
    I use FSO to maniplulate the content.

    When the user activate the link for the navigator, the name of the file will be passed to the function:

    For instance:

    Function getContent(fileInclude)
    Dim objFSO
    Dim objText
    Dim strPage

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    Set objText = objFSO.OpenTextFile(Server.MapPath(fileInclude))

    getContent = objText.ReadAll

    Set objText = Nothing
    Set objFSO = Nothing

    End Function

    nameFile = Request.QueryString("nf") "http://www.sitename.com/default.asp?action=feature&cid=0

    If nameFile <> "" and codeID = "0" Then 'the code ID is to indicate the condition of the file
    fileName = nameFile & ".inc"
    strPage = getContent(fileName)
    ElseIf ..........
    ElseIf ..........
    End If

    1.)I really don't know what approach should i take for creating my search engine.
    After a long searching, I'm thinking of adopting one of these way:
    Way1: using the index server 3 (http://asp-help.com/articles/2000_indexserver3.asp). I feel it is easy to understand and implement. But I still have problem on specifying the URL of the pages. May be I need to manually create the link. What I mean to manually create the link is I use the split function (or may be FSO object) to split the URL return by Vpath : for instances:

    "http://www.website.com/" & Foldername & "action=" & FileName & "cid=" & id &

    Way2: use FSO method(http://www.4guysfromrolla.com/webtech/102499-1.shtml )but I 'm facing problem on get the decription of the file since the File object don't have this property.

    Way3 : Create a database with 3 fields -> Doc_ title, Doc_ decription, and Doc_URL and use SQL statement as below:
    select Doc_decription
    from yourtable
    where memofield like '*Word1*'
    or memofield like '*Word2*'

    to search for the match.

    I don't know whether they are applicable or not.

    2.) I'm wondering how do most of the web-sites implement their search engine, for example: asp101.com.
    Their content is in database -driven format as well as static content which is wtitten in .asp and html format.

    3.) I don't know whether what i'm thinking is the correct way, is the asp101.com search engine is implemented in such as way where by it searchs the page through the database which has fields such as

    Doc Title
    Doc Decription
    Doc URL
    Doc Id

    Please advice!!! I 'm lost......

  2. #2
    Join Date
    Jan 2003
    Dundee, Scotland
    if you use the Folder Collections Fodler Object you can do something like this:
    dim depth
    Set FSYS = CreateObject("Scripting.FileSystemObject")
    ' Specify here the folder to map
    folderSpec = "c:\Inetpub\wwwroot\"
    ScanFolder (folderSpec)
    response.Write "*****END OF DIRECTORY LISTING*****"

    Sub ScanFolder(folderSpec)
    depth = depth + 1
    set thisFolder = FSYS.GetFolder(folderSpec)
    set sFolders = thisFolder.SubFolders
    Set AllFiles = thisFolder.Files

    For i = 0 to depth
    indent = indent & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
    For Each fileItem In AllFiles
    response.write indent & "<A HREF='\"&FileItem.Name&"'>"&FileItem.Name&"</a>"
    Response.write "<BR>"
    For Each folderItem In sFolders
    indent = ""
    response.write "<B>" & folderItem.Path & "</b><BR>"
    ScanFolder (folderItem.Path)
    depth = depth - 1
    End Sub
    You should be able to modify the script to suit your self.

    Hope this helps

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center