简体   繁体   中英

Lucene / SOLR term to number range proximity search

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM