1
votes

I am using SOLR 4.9.0 with the following configuration (I am including only the part I consider relevant to the question):

    <field name="content"   type="text" indexed="true" stored="false"
 termVectors="true" multiValued="false" />

     <fieldType name="text" class="solr.TextField">
         <analyzer type="index">
             <tokenizer class="solr.StandardTokenizerFactory" />
             <filter class="solr.LowerCaseFilterFactory" />
         </analyzer>
         <analyzer type="query">
             <tokenizer class="solr.StandardTokenizerFactory" />
             <filter class="solr.LowerCaseFilterFactory" />
         </analyzer>
     </fieldType>

I can do proximity search for a term being close to another term:

content:"very suggestion"~100

I need to add the functionality of being able to search for a term being close to a number token, such as in:

content:"very [0.01 TO 0.99]"~100
content:"very [100 TO 1000000]"~100

Is there a tokenizer that already provides this functionality?

If not, what would roughly be the steps in order to adapt the standard tokenizer to be able to do that?

Any speculations on what the effect on the index structure, size, and indexing/searching speed would be?

EDIT:

I think that the following SOLR configuration is actually also relevant to my question:

 <requestHandler name="/select" class="solr.SearchHandler">
     <lst name="defaults">
         <str name="echoParams">explicit</str>
         <int name="rows">10</int>
         <str name="df">id</str>
         <str name="wt">json</str>
         <str name="indent">true</str>
         <str name="fl">* score</str>
     </lst>
 </requestHandler>
1
no, as far as i know, you don't have stuff to do it out of the box, also i want to have an example of expected behavior for this new type of queries? could you explain how it should work? - Mysterion
@Mysterion sorry, I thought that was clear. Basically, I want for example content:"very [0.01 TO 0.99]"~100 to return documents in which the token "very" is within 100 tokens from a float that is between 0.01 and 0.99. - yotsov

1 Answers

1
votes

More than two years later, I found the answer to my question :)

By using the

https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-ComplexPhraseQueryParser

one can do:

{!complexphrase inOrder=false}content:"fee [100 10000]"~10