I made the following changes to Omega, per the instructions in
http://www.xapian.org/docs/queryparser.html,
and wildcards do not work at all.  I'm hoping its something simple.
/usr/lib/cgi-bin/omega/omega DB=pdf P=finan\*
(with or without the backslash)
returns no documents, even though there are over 3000 hits for
'finance', about the same for 'financial', and probably more.
...Ken
ken@phobos:~/xapian/xapian-omega-1.0.2$ diff -aur query.cc*
--- query.cc    2007-10-02 14:33:35.000000000 -0500
+++ query.cc~   2007-07-04 19:38:41.000000000 -0500
@@ -218,6 +218,7 @@
     qp.set_stemming_strategy(option["stem_all"] == "true" ?
Xapian::QueryParser::STEM_ALL : Xapian::QueryParser::STEM_SOME);
     qp.set_stopper(new MyStopper());
     qp.set_default_op(default_op);
+    qp.set_database(db);
     // std::map::insert() won't overwrite an existing entry, so we'll
prefer
     // probabilistic prefixes to boolean ones in the unlikely event
that both
     // exist for the same term prefix.  We'll also prefer the first
specified
@@ -236,17 +237,12 @@
     }
     try {
-       query = qp.parse_query(query_string,
-                               Xapian::QueryParser::FLAG_BOOLEAN |
-                               Xapian::QueryParser::FLAG_PHRASE |
-                               Xapian::QueryParser::FLAG_LOVEHATE |
-                               Xapian::QueryParser::FLAG_WILDCARD);
+       query = qp.parse_query(query_string);
     } catch (Xapian::QueryParserError &e) {
        error_msg = e.get_msg();
        return BAD_QUERY;
     }
-    qp.set_database(db);
     Xapian::termcount n_new_terms = 0;
     for (Xapian::TermIterator i = query.get_terms_begin();
         i != query.get_terms_end(); ++i) {
On Tue, Oct 02, 2007 at 03:34:07PM -0500, Kenneth Loafman wrote:> I made the following changes to Omega, per the instructions in > > http://www.xapian.org/docs/queryparser.html, > > and wildcards do not work at all. I'm hoping its something simple. > > /usr/lib/cgi-bin/omega/omega DB=pdf P=finan\* > (with or without the backslash) > > returns no documents, even though there are over 3000 hits for > 'finance', about the same for 'financial', and probably more.You may be being tripped up by your shell escaping there. Try P='finan*' instead of what you have. Cheers, James -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org
Kenneth Loafman wrote:> I made the following changes to Omega, per the instructions in > > http://www.xapian.org/docs/queryparser.html, > > and wildcards do not work at all. I'm hoping its something simple. > > /usr/lib/cgi-bin/omega/omega DB=pdf P=finan\* > (with or without the backslash) > > returns no documents, even though there are over 3000 hits for > 'finance', about the same for 'financial', and probably more.(I'm assuming your diff is reversed, so that "-" lines are those which you added. If that's wrong, I'm very confused.) It looks like you've changed the flags for the query parser "parse_query" invocation correctly. However, you've moved the "qp.set_database(db)" call to after this invocation. As a result, the wildcard expansion code can't lookup the terms in the database, so you end up with no matches. I expect it will work if you move the set_database() call back to its original location. -- Richard
[Please keep discussions on list.] On Tue, Oct 02, 2007 at 04:38:58PM -0500, Kenneth Loafman wrote:> > You may be being tripped up by your shell escaping there. Try > > P='finan*' instead of what you have. > > That's what the escape char is for (bash). Quotes do not help either, > however, 'finan*' finds 295, where 'finan\*' finds 0. Does not work > using the web query either. Strange results.I didn't know which shell you were using; in general I prefer single quotes for avoiding shell globbing (but I can't explain why). Richard has pointed out where your problem is, which I missed. J -- /--------------------------------------------------------------------------\ James Aylett xapian.org james@tartarus.org uncertaintydivision.org