[Xapian-discuss] Results Filtering

James Aylett james-xapian at tartarus.org
Thu Apr 27 11:44:58 BST 2006


On Thu, Apr 27, 2006 at 05:46:11PM +1200, Georgina Allbrook wrote:

> I am managing to have some success getting omega to work on our website
> but have a couple of questions.  Is it possible to restrict the results
> returned from a query to a particular hostname or subsite?
> For some subsites I have a separate database, but for many subsites we
> don't create separate databases.
> 
> In english I think the query might be something like: url starts with
> www.mysite.com/bob/ and (word1 and words).
> 
> Reading the docs it would seem that I need to use boolean filter terms,
> or maybe match decider.

Just a boolean filter term will do. When you're indexing with omindex,
then you're probably doing something like:

----------------------------------------------------------------------
$ omindex -p --db /my/db/path --url 'http://www.mysite.com/bob' \
  /var/www/www.mysite.com/bob
----------------------------------------------------------------------

in which case omindex will generate a boolean term Pbob for all
documents created during that index. You then need to have B=Pbob as
an http parameter to omega.cgi when searching, so something like:

----------------------------------------------------------------------
<select name='B'>
  <option vlaue=''>Entire site</option>
  <option value='Pbob'>Bob's bits</option>
  <option value='Pcorporate'>Corporate information</option>
  <option value='Pcheese'>History of cheese</option>
</select>
----------------------------------------------------------------------

should do what you need - I haven't used this recently, but that's one
of the reasons the subsite concept was added to omega.

Cheers,
James

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org



More information about the Xapian-discuss mailing list