>> Could i get this match length (docFreq) without using searcher.search(..) ?

Yes, but it's likely to involve more code on your part. TermPositions is class 
you want to look at. See the PhraseQuery implementation for examples of how to 
use this.

>> One more doubt is "Preformace for getting search length by using 
>> searcher.search(...) is same as using reader.docFreq(..)??;

It will be slower - but then again calling docFreq is not a solution in your 
case anyway
Incidentally, one more obscure solution which would allow you to use docFreq is 
to use an Ngram Analyzer to build your index out of not just single words but 
pairs of words. Not sure what your end-goal is and therefore if there is any 
real value in adopting this approach.

The old adage of avoiding "premature optimization" applies. If the 
searcher-based code I provided is fast enough (cache the searcher) then avoid 
yourself the coding effort of using TermPositions API or the index 
overhead/complexity of using NGram analyzers. 


Cheers
Mark



----- Original Message ----
From: SK R <[EMAIL PROTECTED]>
To: java-user@lucene.apache.org
Sent: Tuesday, 20 March, 2007 11:14:07 AM
Subject: Re: can't get docFreq of phrase

Hi Mark,
         Thanks for your reply.
          Could i get this match length (docFreq) without using
searcher.search(..) ?

          One more doubt is "Preformace for getting search length by using
searcher.search(...) is same as using reader.docFreq(..)??;

On 3/20/07, mark harwood <[EMAIL PROTECTED]> wrote:
>
>         IndexSearcher s=new IndexSearcher("/indexes/myindex");
>         PhraseQuery pq = new PhraseQuery();
>         pq.add(new Term("contents","test"));
>         pq.add(new Term("contents","under"));
>         int df=s.search(pq).length();
>
> Cheers
> Mark
> ----- Original Message ----
> From: SK R <[EMAIL PROTECTED]>
> To: java-user@lucene.apache.org
> Sent: Tuesday, 20 March, 2007 10:32:32 AM
> Subject: can't get docFreq of phrase
>
> Hi,
>     I can get docFreq. of single term like (f1:test) by using
> indexReader.docFreq(new Term("f1","test")). But can't get docFreq. of
> phrase
> term like f2:"test under") by the same method.
>
>     Is  anything wrong in this code?
>     Please help me to resolve this problem.
>
>
> Thanks & Regards
> RSK
>
>
>
>
>
>
> ___________________________________________________________
> All New Yahoo! Mail – Tired of unwanted email come-ons? Let our SpamGuard
> protect you. http://uk.docs.yahoo.com/nowyoucan.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>





        
        
                
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at 
the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to