You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Renaud Delbru <re...@deri.org> on 2008/03/10 19:45:56 UTC

How to get incrementPositionGap value from IndexSchema ?

Hi,

I am looking for a way to access the incrementPositionGap value defined 
for a field type in the schema.xml.
There is a getArgs method in FieldType class, but it is protected and I 
am not able to access it.
Is there another solution ?

Regards.

-- 
Renaud Delbru,
E.C.S., Ph.D. Student,
Semantic Information Systems and
Language Engineering Group (SmILE),
Digital Enterprise Research Institute,
National University of Ireland, Galway.
http://smile.deri.ie/

Re: How to get incrementPositionGap value from IndexSchema ?

Posted by Renaud Delbru <re...@deri.org>.
Hi Chris,

Thanks for your reply. Indeed, there is the getPositionIncrementGap 
method, I forgot it.

I need this information to be able to configure my query processor. I 
have extended Solr with a new query parser to be able to search document 
on a sentence-based granularity. Each sentence is a fieldable instance 
of a field 'sentences', and I execute span queries to be able to match a 
boolean combination of terms on a sentence-level, not a document-level.
I hope this explanation is clear and makes sense.

Regards.


Chris Hostetter wrote:
> : I am looking for a way to access the incrementPositionGap value defined for a
> : field type in the schema.xml.
>
> I think you mean "positionIncrementGap"
>
> It's a property of the <fieldtype> in schema.xml, but internally it's 
> passed to SolrAnalyzer.setPositionIncrementGap.  if you want to 
> programaticly know what the "positionIncrementGap" is for any analyzer of 
> any field or fieldtype regardless of wether or not it's a SolrAnalyzer, 
> just use Analzer.getPositionIncrementGap(String fieldName) 
>
> ie: myFieldType.getAnalyzer().getPositionIncrementGap(myFieldName)
>
>
> If you don't mind me asking:  why do you want/need this information in 
> your custom code?
>
>
> -Hoss
>   


-- 
Renaud Delbru,
E.C.S., Ph.D. Student,
Semantic Information Systems and
Language Engineering Group (SmILE),
Digital Enterprise Research Institute,
National University of Ireland, Galway.
http://smile.deri.ie/

Re: How to get incrementPositionGap value from IndexSchema ?

Posted by Chris Hostetter <ho...@fucit.org>.
: I am looking for a way to access the incrementPositionGap value defined for a
: field type in the schema.xml.

I think you mean "positionIncrementGap"

It's a property of the <fieldtype> in schema.xml, but internally it's 
passed to SolrAnalyzer.setPositionIncrementGap.  if you want to 
programaticly know what the "positionIncrementGap" is for any analyzer of 
any field or fieldtype regardless of wether or not it's a SolrAnalyzer, 
just use Analzer.getPositionIncrementGap(String fieldName) 

ie: myFieldType.getAnalyzer().getPositionIncrementGap(myFieldName)


If you don't mind me asking:  why do you want/need this information in 
your custom code?


-Hoss