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 BooleanScore

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 = n

Re: using boolean operators with the PhraseQuery

2006-04-22 Thread Paul Elschot
On Friday 21 April 2006 21:11, Vishal Bathija wrote: > 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 You can use SpanNearQuery as a c

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; termCou

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 http://wiki.apache.org/jakart

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 Qu

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 am not sure if I understand you. Do I add the terms for the second phrase immediately after I add the terms for the first phrase. When do i wrap the PhraseQuery I construct into a BooleanQuery. For instance String newTerm1= "avoids deadlock"; String newTerm2= "reduces cost"; PhraseQuery query =

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 boole

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 = tes