2014-12-15 15:37:47 +01:00
2007-02-12 10:42:15 +00:00
2007-05-17 14:49:27 +00:00
2008-03-22 18:01:15 +00:00
2007-02-07 20:06:43 +00:00
2006-03-31 00:34:25 +00:00
2012-05-06 18:52:20 +00:00
2012-05-06 18:52:47 +00:00
2007-02-09 16:29:07 +00:00
2012-05-06 18:52:20 +00:00
2007-02-07 20:06:43 +00:00

README for PHP Swish-e bindings
===============================
$Id$

This extension provides bindings to the swish-e API.

Swish-e is a GPL licensed search engine, with a clause that allows applications
to link against the libswish-e library to use the published API to do so
without invoking the viral portion of the GPL.  This is subject to returning a
link back to the swish-e source code.

Here it is:
http://swish-e.org/index.html

How do I use this?
==================

First you need to have built a swish index.  Consult the swish docs for details
on that: http://swish-e.org/docs/index.html

% swish-e -i /path/to/stuff/to/index

Now build this PHP module:

% phpize
% configure --with-swish=/usr/local
% make
% su -
# make install
# echo 'extension=swish.so' >> /usr/local/lib/php.ini


Then you can code up an interface to the index using PHP:

<?php
$h = new Swish("index.swish-e");
$results = $h->query("lemons");
echo "There are ", $results->hits, " lemons\n";
while ($r = $results->nextResult()) {
	printf("in file %s, relevance %d\n",
		$r->swishdocpath,
		$r->swishrank
		);
}
?>

Brief API reference:
====================
See http://swish-e.org/docs/swish-library.html for more background.

/* major handle class */

class Swish {
	public indexes = array(); //indexes and their properties

	SwishSearch prepare([string query]);
	SwishResult query(string query);

	array getMetaList(string indexname);     
	array getPropertyList(string indexname); 
}

/* search handle class */

class SwishSearch {
	void setStructure(int structure);
	void setPhraseDelimiter(string delimiter_char);
	void setSort(string sort_string);
	void setLimit(string property, string low, string high);
	void resetLimit();
	SwishResults execute([string query]);
}

/* search results class */

class SwishResults {
	public hits = 0;
	public indexes = array();

	SwishResult nextResult();
	int seekResult(int position);
	array getParsedWords(string indexname);
	array getRemovedStopWords(string indexname);
}

/* search result class */

class SwishResult {
	/* 
	   properties defined by Swish, 
	   automatically "converted" to object properties
	*/

	array getMetaList(); 
	array stem(string word);
}

vim:ts=2:sw=2:et:
Description
No description provided
Readme 146 KiB
Languages
PHP 50.9%
C 46.6%
M4 2.2%
JavaScript 0.3%