search for: set_database

Displaying 20 results from an estimated 26 matches for "set_database".

2008 Sep 16
0
[PATCH] Add set_max_wildcard_expansion method to the queryparser.
...yparser_internal.h | 4 +++- 6 files changed, 34 insertions(+), 1 deletions(-) diff --git a/search-xapian/XS/QueryParser.xs b/search-xapian/XS/QueryParser.xs index 3bec548..78edaaa 100644 --- a/search-xapian/XS/QueryParser.xs +++ b/search-xapian/XS/QueryParser.xs @@ -49,6 +49,12 @@ QueryParser::set_database(database) CODE: THIS->set_database(*database); +void +QueryParser::set_max_wildcard_expansion(max) + long max + CODE: + THIS->set_max_wildcard_expansion(max); + Query * QueryParser::parse_query(q, flags = 7) string q diff --git a/search-xapian/Xapian/QueryParser.pm b/sea...
2013 Sep 02
2
having trouble with prefixes
...n't seem to run a query that returns the document using any of the terms. Here is the outline of the code that runs the queries I'm trying to run: Database db(db_path.string()); QueryParser queryparser; Stem stemmer("english"); //queryparser.set_stemmer(stemmer); queryparser.set_database(db); queryparser.add_prefix("type", "T"); queryparser.add_prefix("md5sum", "Q"); queryparser.add_prefix("path", "P"); queryparser.add_prefix("extension", "E"); //maybe set stemming strategy here (in query parser)?...
2007 Oct 26
3
Selecting a database from the application itself?
Hi everybody, I just started thinking about a project and am seeking some help regarding its design. The idea would be to create labels (i.e. address labels).I could let users type the text manually, but I dont think they would appreciate that when they''ll want to print 5000 addresses. I can also probably let them import csv files, that should not be a problem, but playing with those
2007 Dec 29
3
Term-Flags
Hi, Is it necessary to set the down below flag to the TermGenerator, if I want the "Did you mean ..." spelling corrections? Xapian::TermGenerator::flags::FLAG_SPELLING Thank you very much Markus
2007 Mar 29
1
"Bad serialised query" error
...k a problem when using remote queries and hoping someone can offer some guidance. I haven't managed to get a C++ reproduction in the test suite, but I have got a demo that fails using Python: import xapian db = xapian.remote_open('localhost', 8100) qp = xapian.QueryParser() qp.set_database(db) query = qp.parse_query('test') enq = xapian.Enquire(db) enq.set_query(query) enq.get_mset(0, 10) This script fails with: xapian.InvalidArgumentError: REMOTE:Bad serialised query I've tracked it down to api/omqueryinternal.cc, in QUnserial::readquery(), and is the 2nd oc...
2007 Dec 17
1
Crashes with spelling enabled and perl.
Hi Guys, Here's a simple test case that causes a segfault with the perl bindings patched to enable spelling correction: use strict; use warnings; use Search::Xapian; my $db = Search::Xapian::WritableDatabase->new("test.db", Search::Xapian::DB_CREATE_OR_OPEN); if (!defined($db)) { die("Failed to open xapian_database: $!"); } my $indexer =
2005 Jun 09
1
Query parser and stemming of norwegian letters
Hello, can I get an explanation of the following. Running the following code: .... pqp=new QueryParser(); Stem stem("norwegian"); cout << "DEBUG " << stem.stem_word(_sXapian)<< endl; pqp->set_stemmer(stem); pqp->set_database(*_pdatabase); pqp->set_default_op(Query::OP_AND); //Set the enquire Query p=pqp->parse_query(_sXapian); cout << " Query " << string(bufSL) << p.get_description() << endl; --- gives the follwing output DEBUG h?y Query norwe...
2009 Mar 02
0
Xapian, PHP bindings and
...$query_string = xapianEncode( $_GET['q'] ); $rset = new XapianRSet(); $qp = new XapianQueryParser(); $stemmer = new XapianStem( 'french' ); $qp->set_stemmer($stemmer); $qp->set_database($database); $qp->set_stemming_strategy(XapianQueryParser::STEM_SOME); $query = $qp->parse_query( $query_string ); //, XapianQueryParser::FLAG_SPELLING_CORRECTION); print 'Parsed query is: '. $query->get_description() .'<br /...
2009 Aug 17
1
Xapian DatabaseError
...ire_once 'xapian.php'; function simpleSearch($query,$path){ try { $database = new XapianDatabase($path); $enquire = new XapianEnquire($database); $qp = new XapianQueryParser(); $stemmer = new XapianStem("italian"); $qp->set_stemmer($stemmer); $qp->set_database($database); $qp->set_stemming_strategy(XapianQueryParser::STEM_SOME); $query = $qp->parse_query($query); echo "<br>Parsed query is: {$query->get_description()}\n"; $enquire->set_query($query); $matches = $enquire->get_...
2010 Mar 31
1
Hyphen search with parse_query()
...; "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'...
2010 Oct 24
1
Cannot index with dynamic spelling data (Perl/Search::Xapian)
This is my test case, what am I doing wrong? It seems that the API is used incorrectly, but I cannot find the problem... --- 8< --- #!/usr/bin/perl use Search::Xapian qw(:all); use strict; my $xa = new Search::Xapian::WritableDatabase ("/tmp/xapian", DB_CREATE_OR_OVERWRITE); my $indexer = Search::Xapian::TermGenerator->new();
2011 Aug 10
0
xapian enquire.set_docid_order(Xapian::Enquire::DESCENDING so slow!
...how can i fetch the newest 10 results as fast as possible? search.py #-*- coding: utf-8 -*- import xapian import sys,time t1 = time.time() db_path = sys.argv[1] terms = sys.argv[2:] try: database = xapian.Database(db_path) terms = ' '.join(terms) qp = xapian.QueryParser() qp.set_database(database) qp.set_default_op(0) #0:OP_AND; 1:OP_OR default query = qp.parse_query(terms) enquire = xapian.Enquire(database) enquire.set_weighting_scheme(xapian.BoolWeight()) enquire.set_query(query) enquire.set_docid_order(enquire.DESCENDING) matches = enquire.get_mset(0,10) pr...
2018 Jun 21
0
Welcome to the "Xapian-discuss" mailing list
...bleDatabase("testdb") doc = xapian.Document() tg = xapian.TermGenerator() tg.set_document(doc) tg.index_text("I am walking, always walking.") db.add_document(doc) Then you can run NEAR queries: import xapian db = xapian.Database("testdb") qp = xapian.QueryParser() qp.set_database(db) def query(query): enq = xapian.Enquire(db) q = qp.parse_query(query) enq.set_query(q) for match in enq.get_mset(0, 10): print(match.docid) query("I NEAR/1 walking") # prints nothing query("I NEAR/2 walking") # prints 1 There's no document in th...
2010 Oct 28
1
hypens in words + NEAR + 3 terms + AND_MAYBE => crash
...ing language was "english", strategy STEM_SOME. Default op was OP_AND_MAYBE. This is the offending Perl code: [...] my $qp = Search::Xapian::QueryParser->new(); my $stemmer = Search::Xapian::Stem->new("english"); $qp->set_stemmer($stemmer); $qp->set_database($database); $qp->set_stemming_strategy(STEM_SOME); $qp->set_default_op(OP_AND_MAYBE); $query_string = " x-y NEAR test NEAR test "; my $query = $qp->parse_query($query_string, Search::Xapian::FLAG_DEFAULT); [...] Here's a gdb backtrace for a crash: Progr...
2018 Jul 19
1
choosing between probabilistic and boolean prefixes for terms
...r isn't anything special: our $LANG = 'english'; sub stemmer { Search::Xapian::Stem->new($LANG) } sub qp { my ($self) = @_; my $qp = $self->{query_parser}; return $qp if $qp; # new parser $qp = Search::Xapian::QueryParser->new; $qp->set_default_op(OP_AND); $qp->set_database($self->{xdb}); $qp->set_stemmer($self->stemmer); $qp->set_stemming_strategy(STEM_SOME); $qp->set_max_wildcard_expansion(100); $qp->add_valuerangeprocessor( Search::Xapian::NumberValueRangeProcessor->new(YYYYMMDD, 'd:')); $qp->add_valuerangeprocessor( Search:...
2013 Sep 22
2
How to filter search result with query with has white space.
...("english"); qp.set_default_op(Xapian::Query::OP_FILTER); qp.set_stemmer(stemmer); qp.add_prefix("","title"); qp.add_prefix("","content"); qp.add_boolean_prefix("title","title"); qp.set_database(db); qp.set_stemming_strategy(Xapian::QueryParser::STEM_SOME); Xapian::Query query = qp.parse_query(query_string); std::cout << "Parsed query is: " << query.get_description() << std::endl; enquire.set_query(query); Xapian::MSet mat...
2013 Sep 22
2
How to filter search result with query with has white space.
...("english"); qp.set_default_op(Xapian::Query::OP_FILTER); qp.set_stemmer(stemmer); qp.add_prefix("","title"); qp.add_prefix("","content"); qp.add_boolean_prefix("title","title"); qp.set_database(db); qp.set_stemming_strategy(Xapian::QueryParser::STEM_SOME); Xapian::Query query = qp.parse_query(query_string); std::cout << "Parsed query is: " << query.get_description() << std::endl; enquire.set_query(query); Xapian::MSet mat...
2015 Jul 26
1
Get term from document by position
...n::TermGenerator::STEM_ALL_Z); indexer.index_text(text_to_index.text_str); db_w.add_document(doc); db_w.commit(); db_w.close(); //searching Xapian::Database db(database_dir); Xapian::Enquire enquire(db); Xapian::QueryParser qp; qp.set_stemmer(stemmer); qp.set_database(db); qp.set_default_op(Xapian::Query::OP_NEAR); qp.set_stemming_strategy(Xapian::QueryParser::STEM_ALL_Z); std::cout << "\n###################################################\n"; std::cout << "query string: " << query_string << "\n&qu...
2014 Jan 21
2
seg fault on search
...uot;/var/lib/fulltext/%s",dbname); queryString=qs; try { Database db; db.add_database(Database(fullDB)); Enquire enquire(db); try { Xapian::QueryParser qp; Xapian::Stem stemmer("english"); qp.set_database(db); qp.set_default_op(Query::OP_OR); qp.set_stemmer(stemmer); qp.set_stemming_strategy(QueryParser::STEM_SOME); Xapian::Query q=qp.parse_query(queryString); ... As soon as it hits the q=qp.parse_query line it gets the seg fault. Th...
2015 Dec 28
3
synonym expansion for boolean prefixes.
...any replies, I'm not subscribed to the list. ###################################################################### import xapian db=xapian.WritableDatabase("db",xapian.DB_CREATE_OR_OPEN) db.add_synonym("Kfoo","Kbar") db.commit(); qp = xapian.QueryParser() qp.set_database(db); # replacing add_prefix with add_boolean_prefix stops synonym expansion, tested with 1.2.21 qp.add_prefix("tag","K") query=qp.parse_query("tag:foo",xapian.QueryParser.FLAG_AUTO_SYNONYMS) print query; -------------- next part -------------- A non-text attachment...