Re: using boolean operators with the PhraseQuery

2006-04-24 Thread Vishal Bathija
How do I get the spans (getSpans()) if I use the SpanNearQuery as a clause (subquery) in a BooleanQuery I currently have SpanQuery [] clauses1 = new SpanQuery[phraseTerms1.length]; for(int count =0; count phraseTerms1.length; count++) { clauses1[count]=phrase1[count]; } SpanQuery [] clauses2 =

Re: using boolean operators with the PhraseQuery

2006-04-24 Thread Paul Elschot
On Monday 24 April 2006 16:24, Vishal Bathija wrote: How do I get the spans (getSpans()) if I use the SpanNearQuery as a clause (subquery) in a BooleanQuery You can't normally. The Spans of the subqueries are used to compute the scores of each matching document, via SpanScorer and

Re: using boolean operators with the PhraseQuery

2006-04-21 Thread Vishal Bathija
Hi, I am trying to get the frequency of a phrase using the SpanNearQuery. How can I use SpanNearQuery for boolean queries. The code I have is for a single query. How can I extend this for multiple queries SpanTermQuery[] phrase = new SpanTermQuery[phraseTerms.length]; for(int termCount=0;

Re: using boolean operators with the PhraseQuery

2006-04-19 Thread Daniel Naber
On Mittwoch 19 April 2006 07:25, Vishal Bathija wrote: Query= contents:provides  distribution contents:supports  distribution Why are there two spaces between those words? I am not sure why it returns 0, when I have both phrases present in the docs. See

using boolean operators with the PhraseQuery

2006-04-18 Thread Vishal Bathija
Hi, I am trying to find the number of hits for a phrase using the PhraseQuery. I would like to know how I could seach for 2 phrases at the same time using the boolean operators OR, AND. The code snippet that I use to seach for one phrase is String test =avoids deadlock String[] phraseTerms =

Re: using boolean operators with the PhraseQuery

2006-04-18 Thread Erik Hatcher
Wrap the PhraseQuery's inside a BooleanQuery to achieve AND/OR. Erik On Apr 18, 2006, at 10:00 PM, Vishal Bathija wrote: Hi, I am trying to find the number of hits for a phrase using the PhraseQuery. I would like to know how I could seach for 2 phrases at the same time using the

Re: using boolean operators with the PhraseQuery

2006-04-18 Thread Chris Hostetter
: The code above just adds the terms of phrase2 following the : terms for phrase1. : Can you give me an example building a BooleanQuery OR for the : newTerm1 and newTerm2. At no point does your code use a BooleanQuery ... have you looked at the javadocs for the BooleanQuery class? -Hoss

Re: using boolean operators with the PhraseQuery

2006-04-18 Thread Vishal Bathija
I tried using the boolean query to perform an OR as below BooleanQuery b1 = new BooleanQuery(); b1.add(query,BooleanClause .Occur .SHOULD ); b1.add(query2,BooleanClause .Occur .SHOULD ); Hits hits = searcher.search(b1); System.out.println(Query= +b1.toString() ); gave me