You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Matthew Hall <mh...@informatics.jax.org> on 2008/03/04 22:06:02 UTC
Looking for an example of Using Position Increment Gap
Fellows,
I'm working on a project here where we are trying to use our lucene
indexes to return concrete objects. One of the things we want to be
able to match by is by vocabulary terms annotated to that object, as
well as all of the child vocabulary terms of that annotated term.
So, what I was thinking about doing is extending my index that returns
objects of that type to include a new field say "sub_term". In this
field I would put all of the text of these vocabulary sub terms
together, and introduce phrase boundries using some of the techniques
that are described in the Javadoc in the analysis section. (Basically
writing a custom analyzer that introduces a position increment gap
between phrases) I am however curious if an example of a usage like
that exists somewhere that I could use as a basis for the analyzer that
I'm going to have to write to handle this case.
Does anyone know of a good example?
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Looking for an example of Using Position Increment Gap
Posted by Chris Hostetter <ho...@fucit.org>.
: the analysis section. (Basically writing a custom analyzer that introduces a
: position increment gap between phrases) I am however curious if an example of
: a usage like that exists somewhere that I could use as a basis for the
: analyzer that I'm going to have to write to handle this case.
Bear in mind, when people talk about "position increment GAP" they are
usually refering explicitly to the method
Analyzer.getPositionIncrementGap(String) .. which is what gets called when
a Document is being analyzed and it contains two or more instances of
"Field" that have hte same field name.
what you are asking about sounds more like the more basic "position
increment" ... which defaults to "1" for each Token and can be changed by
calling Token.setPositionIncrement(int). a quick krugle search can find
you lots of examples of using this method...
http://www.krugle.org/kse/files?query=setPositionIncrement&lang=java
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org