You probably are aware of this already, but I want to be sure. positionIncrementGap is _only_ applied between the last term of one multiValued entry and the first term of the next. So say I have a text field and the input looks like:
<doc> <field name="text">some stuff </field> <field name="text">other words </field> </doc> and my positionIncrementGap is 100. The term positions are some = 0 stuff = 1 other = 101 words = 102 The equivalent in SolrJ is doing a SolrInputDocument.addField() call twice. I'm just wondering if you could get the behavior you need by some clever usage of multiValued fields.... Best, Erick On Sun, Dec 17, 2017 at 11:29 PM, Amin Raeiszadeh <amin24march1...@gmail.com> wrote: > thanks too much Erick and mikhail. > i change SloppyPhraseScorer class for my custom behavior with some fields. > so i need to index some fields with customized gap between terms of fields. > i'm not profession with solr and i think with schema.xml only i can > set fixed gap increment between terms of field but i need to calculate > base on some formula and then decide how much gap should be set > between each term. > i think i should use some thing like plug-in or inject some code to > index flow of solr as you described. > > On Sun, Dec 17, 2017 at 9:18 PM, Mikhail Khludnev <m...@apache.org> wrote: >> On Sun, Dec 17, 2017 at 11:16 AM, Amin Raeiszadeh <amin24march1...@gmail.com >>> wrote: >> >>> thanks for your guides Mikhail. >>> in multiple values i can only set static positionIncrementGap but >>> considering my description i need dynamic gap between terms and >>> i don't know how to do it. >>> >> There is a jira ticket regarding it, but I can't find it. >> >> >>> >>> i can only pass String value for fields like this: >>> >>> SolrInputDocument sDoc = new SolrInputDocument(); >>> sDoc.setField("a", "a1"); >>> >>> is there any way to create luceneDocument and commit it to solr >>> with solrj ? or put some Other Type of Value such as TextField instead >>> of String? >>> >> Converting SolrInputDocument to Lucene's doc is done in >> AddUpdateCommand.getLuceneDocument(boolean) >> So, you probably can inject your own UpdateRequestProcessor which can do >> it. >> But you probably do it in TokenFilter, why you can't hook it up in >> schema.xml? >> >> >>> >>> On Sun, Dec 17, 2017 at 10:43 AM, Mikhail Khludnev <m...@apache.org> >>> wrote: >>> > You can assign multiple values to text field and leverage >>> > positionIncrementGap >>> > https://lucene.apache.org/solr/guide/6_6/field-type- >>> definitions-and-properties.html#general-properties >>> > >>> > And why wouldn't you use your Lucene plugin in Solr? >>> > >>> > On Sun, Dec 17, 2017 at 8:45 AM, Amin Raeiszadeh < >>> amin24march1...@gmail.com> >>> > wrote: >>> > >>> >> how is it possible to add custom gaps between terms of >>> >> TextFiled in solr documents. for example between term >>> >> number 1 and 2 we need 200 gap and between term number >>> >> 2 and 3 we need 1000 gap. >>> >> i can only send key-value pair as String to solr(then solr >>> >> index fields in different types according to schema ) and i can >>> >> not find a way to build field content manually and put them >>> >> to solr. >>> >> in lucene i create a custom position increment class and i >>> >> use it to add custom gaps between terms in token stream. >>> >> >>> > >>> > >>> > >>> > -- >>> > Sincerely yours >>> > Mikhail Khludnev >>> >> >> >> >> -- >> Sincerely yours >> Mikhail Khludnev