Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A little Research and whoooo, i Got it...</p> <p>First Created an Index Reader Object like that...</p> <pre><code>Dim indexReader As Lucene.Net.Index.IndexReader indexReader = New Lucene.Net.Index.IndexReader.Open(INDEX_DIRECTORY, True) </code></pre> <p>Then create span near query for your Each term like that...</p> <pre><code>Dim spanQuery1 As SpanTermQuery = New SpanTermQuery(New Term(FIELD, "2")) Dim spanQuery2 As SpanTermQuery = New SpanTermQuery(New Term(FIELD, "year")) Dim near As SpanNearQuery = New SpanNearQuery(New SpanQuery() {spanQuery1, spanQuery2}, 0, False) </code></pre> <p>Create a Span object to store all matched spans....</p> <pre><code> Dim spans As Spans = near.GetSpans(indexReader) </code></pre> <p>Iterate through each span to get the number of span occurences..</p> <pre><code> Dim num As Integer = 0 While (spans.Next) num += 1 End While </code></pre> <p>Now num contains the number of occurences for Phrase "1 year".</p> <p>currently it shows no of occurences for all docs. You can skip to any document using</p> <pre><code>spans.SkipTo(i) </code></pre> <p>and can find whether phrase is in current doc or not by</p> <pre><code>spans.doc() </code></pre> <p>I got this idea from <a href="http://www.google.co.in/url?sa=t&amp;rct=j&amp;q=phrase%20occurrences%20lucene.net&amp;source=web&amp;cd=4&amp;ved=0CD4QFjAD&amp;url=http://www.cnlp.org/apachecon2005/AdvancedLucene.ppt&amp;ei=ekVIUI6RDsnVrQfb6YGQDQ&amp;usg=AFQjCNGXYv_JuKCnIdfBy0oQ2hQth8zWYA" rel="nofollow">This PPT</a>. May be that can help u answer many of your other questions...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload