Opened 13 years ago

Closed 13 years ago

#527 closed defect (notabug)

Eset unexpected behaviour

Reported by: fulltext Owned by: Olly Betts
Priority: normal Milestone:
Component: Search::Xapian Version: 1.2.4
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

I have a database with multiple fields and only one search (index_text) field. The search runs as expected. Then I create Rset out of 5 top search results and use get_eset() on it. The problem is that it returns suggestions that include ALL database fields (including for example keys). Should not all suggestions returned by Eset be limited to the search field only? My code is based on http://xapian.org/docs/bindings/php/examples/simpleexpand.php5

Change History (1)

comment:1 by Olly Betts, 13 years ago

Resolution: notabug
Status: newclosed

This is the intended behaviour.

To filter the returned terms, you would ideally subclass Xapian::ExpandDecider to specify the criteria for selecting terms to return.

You set the component to Search::Xapian (i.e. the Perl bindings) but refer to the PHP example, so I'm not sure which you are using.

If it's Perl, then you can pass a subroutine or anon sub for the decider, e.g.:

$enq->get_eset( 10, $rset, sub { $_[0] !~ /^[A-Z]/ } );

If it's PHP, then I'm afraid that currently such subclassing isn't supported in PHP. The best workaround I can suggest there is to ask for more terms than you want and filter the list returned (not ideal as Xapian may have to do more work, and you may not get all the terms you want, but I think it's the best you can do in PHP currently).

Note: See TracTickets for help on using tickets.