search for: set_default_op

Displaying 20 results from an estimated 23 matches for "set_default_op".

2011 Mar 23
1
how to change the default operator?
Hi all, I'm sorry to bother you guys with such a rookie question. I tried to change the default boolean operator by editing the file queryparser.h like this: void set_default_op(Query::op OP_AND); However, after rebuilding I tested it with the query "grad school" and it still worked with the OP_OR as default, like this: Parsed query is: Xapian::Query((Zgrad:(pos=1) OR Zschool:(pos=2))) Could somebody give me any clue about this? Is there any other file in the...
2023 Mar 30
1
Having trouble with php8 bindings
...pianWritableDatabase; Thank you very much. This then (because of course) led to some more things needing tidying up and I've run into something I can't work out while trying to update previously-worked-in-php7 code in the actual file I'm trying to update $this->queryparser->set_default_op(Query_OP_AND); ...leads to "Undefined constant "App\Helpers\Query_OP_AND" because... another namespace issue? ("OP_AND" and "XapianQueryParser::OP_AND" are also not accepted.) jh
2007 Dec 31
2
"and" without boolean operators
Salve, Thank you very much for your kind answer. Spelling correction works very well now. I have just one more question. I am using Xapian::QueryParser() to create the Query. The flags are: FLAG_PHRASE | FLAG_LOVEHATE | FLAG_WILDCARD If I search, lets say for "king queen" (without quotes), I get all documents with either "king" or "queen". Is there a chance to
2009 Jan 10
2
QueryParser::parse_query() uses OR by default? How to switch to AND?
I use the QueryParser::parse_query() method but I see it uses "OR" by default between words? Is there a way to make it use "AND" instead? I see there are flags I can pass to the parse_query() method but none seems to allow a switch from OR to AND. I would like to do that without having to write my own query parser. Everything else is fine with the QueryParser parsing, for
2011 Jul 14
1
'phrase' default-op mixed with hyphenated words
...arser's default op to OP_PHRASE: Xapian raises an Unimplemented Error if the query contains hyphenated words or other terms that implicitly generate a phrase. This can be shown with the following Python extract: >>> from xapian import * >>> qp = QueryParser() >>> qp.set_default_op(Query.OP_PHRASE) >>> print qp.parse_query('John Smith-Jones') Traceback (most recent call last): File "<stdin>", line 1, in <module> xapian.UnimplementedError: Can't use NEAR/PHRASE with a subexpression containing NEAR or PHRASE I'm using the latest...
2023 Mar 30
1
Having trouble with php8 bindings
On Thu, Mar 30, 2023 at 04:42:41AM +0100, John Handelaar wrote: > It appears that I can't use anything in PHP8.2 if the PHP file from > which I want to access xapian contains a namespace declaration, > because the PHP functions themselves cannot be found. You need to tell PHP to look in the root namespace, e.g.: $test = new \XapianWritableDatabase('searchdb'); Another
2023 Mar 30
1
Having trouble with php8 bindings
...hn Handelaar wrote: > This then (because of course) led to some more things needing tidying > up and I've run into something I can't work out while trying to update > previously-worked-in-php7 code in the actual file I'm trying to update > > $this->queryparser->set_default_op(Query_OP_AND); > > ...leads to "Undefined constant "App\Helpers\Query_OP_AND" because... > another namespace issue? > > ("OP_AND" and "XapianQueryParser::OP_AND" are also not accepted.) It's `XapianQuery::OP_AND`, which was also the correct n...
2005 Jun 09
1
Query parser and stemming of norwegian letters
...llowing. 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 norwegianXapian::Query((ha:(pos=1) AND y:(pos=2))...
2011 Aug 10
0
xapian enquire.set_docid_order(Xapian::Enquire::DESCENDING so slow!
...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) print "%i results found . &...
2011 Sep 30
1
Slow phrase performance
...g it to limit the maximum number of matches, but that doesn't seem to help on common terms. I am not limiting the number of matches -- I want all of them. But even on small sets like "kansas state" with just 334 results, it's taking a long time. The following are set: $qp->set_default_op(OP_AND); $qp->set_stemming_strategy(STEM_NONE); Flags enabled: BOOLEAN,BOOLEAN_ANY_CASE,WILDCARD,PHRASE ------------------------------ I have been unable to find reports of other people experiencing the same problem with poor phrase performance, so I am hoping it's simply something that...
2012 Jun 04
1
Search not finding queries with stop words.
I have a search in perl that looks a bit like: my $qp = new Search::Xapian::QueryParser(); $qp->set_stemmer(new Search::Xapian::Stem("english")); $qp->set_stemming_strategy(STEM_SOME); $qp->set_default_op($defaultop); ... my $par = $qp->parse_query($query); my $enq = $xDatabase->enquire( $par ); and in the db create script: my $stopper = Search::Xapian::SimpleStopper->new(); foreach my $word (@ar) { $stopper->add($word); } ... my $doc = Search::Xapian::...
2013 Aug 21
2
Perl interface isn't working in 1.2.x
...y it used to. Code: $db = Search::Xapian::Database->new( $dx ); my $qp = Search::Xapian::QueryParser->new(); my $dbSize=$db->get_doccount(); # $qp->set_stemmer(new Search::Xapian::Stem("english")); # $qp->set_stemming_strategy(STEM_SOME); # $qp->set_default_op($defaultop); my $par = $qp->parse_query($query); my $enq = $db->enquire( $par ); my @matches = $enq->matches($nstart,$nrecords); my $mset = $enq->get_mset($nstart,$nrecords); my $est = $mset->get_matches_estimated(); my $totTime=0; foreach my $matc...
2007 May 30
1
QueryParser prefixing terms when stemming?
...d help figuring out how my code should be written. In version 0.9.9.1 of Search::Xapian, the following code results in this output "Xapian::Query(pet:(pos=1))". my $qp = new Search::Xapian::QueryParser; $qp->set_stemmer(new Search::Xapian::Stem('english')); $qp->set_default_op(OP_AND); $qp->set_stemming_strategy(STEM_SOME); warn $qp->parse_query($search_term); In version 1.0.0.0, the same code results in "Xapian::Query(Zpet: (pos=1))". The result is no matches, even though the term pet exists. If I use STEM_NONE, the output is the same as the...
2010 Oct 28
1
hypens in words + NEAR + 3 terms + AND_MAYBE => crash
.... 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: Program received signal SIGSEGV, Segmentation fault. ~TermGroup (yypParser=0x2b58170, yymajo...
2018 Jul 19
1
choosing between probabilistic and boolean prefixes for terms
...... My setup for the query parser 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...
2010 Jan 19
1
QueryParser: aliases and OP_AND
Hello, I'm wondering about how the QueryParser parses a query containing an "alias" when the default operator is OP_AND (by "alias", I mean a search field mapped to multiple term prefixes). With the following php code : <?php $parser=new XapianQueryParser(); $parser->set_default_op(XapianQuery::OP_AND); $parser->add_prefix('alias', 'AUT1:'); $parser->add_prefix('alias', 'AUT2:'); echo $parser->parse_query('alias:(john smith)')->get_description(); ?> I get: Xapian::Query(((AUT1:john:(pos=1) OR AUT2:john:(pos=1)) AND (AUT...
2013 Sep 22
2
How to filter search result with query with has white space.
...) << std::endl; exit(1); }} void searchData(std::string query_string){ try{ Xapian::Database db("/Users/ramesh/Desktop/xapian"); Xapian::Enquire enquire(db); Xapian::QueryParser qp; Xapian::Stem stemmer("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_strate...
2013 Sep 22
2
How to filter search result with query with has white space.
...) << std::endl; exit(1); }} void searchData(std::string query_string){ try{ Xapian::Database db("/Users/ramesh/Desktop/xapian"); Xapian::Enquire enquire(db); Xapian::QueryParser qp; Xapian::Stem stemmer("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_strate...
2015 Jul 26
1
Get term from document by position
...L_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"; std::cout <<...
2014 Jan 21
2
seg fault on search
...); 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. The function is called like so: int main...