Integrating Sphider search engine in to website

2019-07-31 19:10发布

问题:

I have Sphider search engine up and running on my site but I am having two problems.

  1. I am not clear on how to set up the indexing for the results to properly show up.

  2. I am trying to take the search.php file and

    include ('sphider/search.php');
    

    in the dashboard.php file which is located in the root dir of my site.

Sphider is at

root/sphider/search.php

but when I include it nothing shows up. If anyone has any insight on the issues I am having I would appreciate it. Yes I have found some online documentation here and there but nothing that clears this up for me.

回答1:

because sphider is not installed in root directory You might need to update some of your path(s) within search.php eg. add another '../sphider/' in the path of everything so it can reference required php files etc. this way can get very complicated and is probably not worth it.

For my site I created a simple flash search box that uses URL request of 'search.php?query=' + KeywordVar + '&start=1&search=1&results=10' Works great.

AS3 Example:

var KeywordVar = SearchTextBox01.text;
var URLpart1 = 'http://www.yourwebsite.com/search.php?query=';
var URLpart2 = '&start=1&search=1&results=10';
var MySearchLink = URLpart1 + KeywordVar + URLpart2;

MySearchButton.addEventListener(MouseEvent.CLICK,MySearchFunction);


function MySearchFunction(e:Event){navigateToURL(new URLRequest(MySearchLink)); }

In your case I would just use a simple form that uses 'get' to the search 'Search.php' file and then include your header & footer in the Sphider's header & footer Templates. or create your own header & footers to match your requirements.

HTML Example:

<div> 
  <form action="sphider/search.php" method="get"> 
    <input type="text" name="query" id="query" size="40" value=""> 
    <input type="submit" value="Search"> 
    <input type="hidden" name="search" value="1"> 
  </form> 
</div> 


标签: php sphider