lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Braun <>
Subject Re: Best approach for exact Prefix Field Query
Date Thu, 16 Nov 2006 15:13:43 GMT
hi Erik,

> "action and" is likely not a single Term, so you'll want to create a
> SpanNearQuery of those individual terms (that match the way they were
> when analyzed and indexed, mind you) and use a SpanNearQuery inside a
> SpanFirstQuery.   Make sense?
Yes, it works (see below)!
... but with my Java-App I have the Problem that I need to combine this
SpanFirstQuery with a Query from the QueryParser,
i.e. from the Webform I get the SpanFirstQuery (which I am just
.split'ing as inJRuby Sample) and I get another inputfield with a query
I normally parse with the QueryParser.

Is there a way to merge these two query-classes?


   SpanFirstQuery =
   SpanTermQuery  =
   SpanQuery  =
   SpanNearQuery  =

   Term = org.apache.lucene.index.Term

   qs = search.split(/\s/)

   spanq_ar =SpanQuery[].new(qs.length)

   for i in 0...qs.length
      spanq_ar[i] ="TI", qs[i] ) )

   sp =,1,true),
   hits =
   for i in 0...hits.length
      puts hits.doc(i).getField("kurz")

Universitaetsbibliothek Heidelberg   Tel: +49 6221 54-2580
Ploeck 107-109, D-69117 Heidelberg   Fax: +49 6221 54-2623

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message