asma bzd
asma bzd

Reputation: 21

how to make my search system answer the query with boolean operation (+ - or)?

I'm using Lucene for the first time I'm trying to make a search system with the following query...

  QueryParser qp1 = new QueryParser("title", new StandardAnalyzer()); 
  Q1 = qp1.parse(tr.toString()); // The same think for Q,Q2,Q3 


    BooleanQuery idQuery = new BooleanQuery.Builder()
                                .add(Q, BooleanClause.Occur.SHOULD)
                                .add(Q1, BooleanClause.Occur.SHOULD)
                                .add(Q2, BooleanClause.Occur.SHOULD)
                                .add(Q3, BooleanClause.Occur.SHOULD)
                                //.add(Q3, BooleanClause.Occur.SHOULD)
                                .build();

so I wanna add a query that can answer the query with boolean operation AND OR (a+b)(a-b)(a or b)... but I really don't know how to start so please help...

edit: for example, when I search for "search information" in the title I'm having all the documents that contain (search information)(information)(search) but I want the system to be able to answer the "search+ information" : show only the document that contains (search and information), "search - information" show only document contains (search) and without (information), "search | information" this what my system do I think

*pleas I really need help so plz any proposition *

Upvotes: 0

Views: 79

Answers (0)

Related Questions