This website recently got a major rebuild; if you're missing something, let Lorna know.

Lucene search functionality - following on from crawlers and spiders



The search functionality works!!

I have PHP 5.1.2 on a Windows XP machine (I know, I know, its my work desktop) and Zend Framework preview release 1.3. I’m using it to index the files in a local copy of DokuWiki – this is an easy starting point as the pages are text files and all held in directories.

zend_lib.php I have a library file which has some settings used both when building the index and when searching it. This file also includes a function which turns the url of the returned page into a path that dokuwiki can understand. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

zend_text.php The indexing page starts from $startpoint (set in zend_lib.php) and recurses into directories indexing file size, url and content of each file. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

zend_text2.php The search page shows some searching tips and a search box. When a search is performed it then prints links to the pages in dokuwiki and their relevance, ordered by relevance. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I’m so excited that I’m including the files here for now and might think about turning this into a proper dokuwiki plugin – although, personally I like their current search functionality, this current exercise is a PHB requirement. Here are the files:

zend_lib.php

zend_text.php

zend_text2.php


In: tech