README
1NAME
2 Catalyst::Model::Xapian - Catalyst model for Search::Xapian.
3
4SYNOPSIS
5 my ($it,$res)= $c->comp('MyApp::M::Xapian')->search(
6 $c->req->param('q'),
7 $c->req->param('page') ||0 ,
8 $c->req->param('itemsperpage')||0
9 );
10 $c->stash->{searchresults}=$res;
11 $c->stash->{iterator}=$it;
12
13DESCRIPTION
14 This model class wraps Search::Xapian to provide a friendly, paged
15 interface to Xapian (www.xapian.org) indexes. This class adds a little
16 extra convenience on top of the Search::Xapian class. It expects you to
17 use the QueryParser, and sets up some keywords based on the standard
18 omega keywords (id, host, date, month, year,title), so that you can do
19 searches like
20
21 'fubar site:microsoft.com'
22
23CONFIG OPTIONS
24 db Path to the index directory. will default to <MyApp>/index.
25
26 language
27 Language to use for stemming. Defaults to english
28
29 page_size
30 Default page sizes for Data::Page. Defaults to 10.
31
32 utf8_query
33 Queries are passed as utf8 strings. defaults to 1.
34
35 order_by_date
36 Sets weighting to order by docid descending rather than the usual
37 BM25 weighting. Off by default.
38
39METHODS
40 new Constructor. sets up the db and qp accessors. Is called
41 automatically by Catalyst at startup.
42
43 search <q>,[<page>],[<page_size>]
44 perform a search using the Xapian QueryBuilder. expands the document
45 data using extract_data. You can override the page size per query by
46 passing page size as a final argument to the function. returns a
47 Data::Page object and an arrayref to the extracted document data.
48
49 prepare_enq <enq>
50 Prepare enquire object before getting mset. Allows you to modify
51 ordering and such in your subclass.
52
53 extract_data <item> <query>
54 Extract data from a Search::Xapian::Document. Defaults to using
55 Storable::thaw.
56
57 qp Query Parser. The Search::Xapian::QueryParser object used to parse
58 the query.
59
60AUTHOR
61 Marcus Ramberg <mramberg@cpan.org>
62
63LICENSE
64 This library is free software . You can redistribute it and/or modify it
65 under the same terms as perl itself.
66
67