[Xapian-discuss] Hyphen search with parse_query()

Peter Bengtsson peter at fry-it.com
Wed Mar 31 15:00:00 BST 2010


I'm trying to index the word "peter-bengtsson" (which is different
from "peter" & "bengtsson" and is different from "peterbengtsson") and
find it.
To start with I'm trying to use a basic python script to get to grips
with it. When I do this::

    qp = xapian.QueryParser()
    stemmer = xapian.Stem("english")
    qp.set_stemmer(stemmer)
    qp.set_database(database)
    qp.set_stemming_strategy(xapian.QueryParser.STEM_SOME)
    print "Query string is:", repr(query_string)
    query = qp.parse_query(query_string)

    print "Parsed query is: %s" % str(query)

I get the following output::

  Query string is: 'peter-bengtsson'
  Parsed query is: Xapian::Query((ssh:(pos=1) PHRASE 2 bengtsson:(pos=2)))
  22 results found.

This is wrong as I know I only have one document with the word
"peter-bengtsson" in it.
How do I make the search for exactly "peter-bengtsson" or exacly
"ssh-add" or "e-mail"?


-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
fun crosstips.org



More information about the Xapian-discuss mailing list