I’ve just been setting up a site search on a whindows server and decided to use an indexing services search. I had no idea it was so complex. It took me ages to work things out, although I’m neither a windows guru nor a php expert.
Writing php to query indexing services is not particularly complex with the sample from the page above, but there were several things that weren’t mentioned there:
- you need a version of PHP higher than 4.3.10, because of a problem with com objects in that version
- you need to persuade indexing services to index php pages
Most of our PHP pages were just html pages with a .php extension, to keep all of the extensions the same. The proplem was that indexing services wouldn’t index them because it didn’t know what they were. You can get the service to index documents with unknown extensions, but then it won’t scan them for metadata (including the page titles, which was my major worry). I searched for hours before I found a solution
All you need is to download a program called filtreg.exe from Microsoft. It’s part of the Microsoft Windows SDK (a hefty download for a tiny wee program). The you run that on the server with the following command line:
filtreg .php .htm
This not only makes .php a “known” file extension, but then makes indexing services threat the php pages the same way it treats html pages.