Exemplo n.º 1
0
			public PhraseWeight(PhraseQuery enclosingInstance, Searcher searcher)
			{
				InitBlock(enclosingInstance);
				this.searcher = searcher;
			}
Exemplo n.º 2
0
			private void  InitBlock(PhraseQuery enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
Exemplo n.º 3
0
 private void  InitBlock(PhraseQuery enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Exemplo n.º 4
0
 public PhraseWeight(PhraseQuery enclosingInstance, Searcher searcher)
 {
     InitBlock(enclosingInstance);
     this.searcher = searcher;
 }
Exemplo n.º 5
0
        /// <exception cref=""> ParseException throw in overridden method to disallow
		/// </exception>
		protected internal virtual Query GetFieldQuery(System.String field, System.String queryText)
		{
			// Use the analyzer to get all the tokens, and then build a TermQuery,
			// PhraseQuery, or nothing based on the term count
			
			TokenStream source = analyzer.TokenStream(field, new System.IO.StringReader(queryText));
			System.Collections.ArrayList v = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
			Monodoc.Lucene.Net.Analysis.Token t;
			
			while (true)
			{
				try
				{
					t = source.Next();
				}
				catch (System.IO.IOException e)
				{
					t = null;
				}
				if (t == null)
					break;
				v.Add(t.TermText());
			}
			try
			{
				source.Close();
			}
			catch (System.IO.IOException e)
			{
				// ignore
			}
			
			if (v.Count == 0)
				return null;
			else if (v.Count == 1)
				return new TermQuery(new Term(field, (System.String) v[0]));
			else
			{
				PhraseQuery q = new PhraseQuery();
				q.SetSlop(phraseSlop);
				for (int i = 0; i < v.Count; i++)
				{
					q.Add(new Term(field, (System.String) v[i]));
				}
				return q;
			}
		}