简体   繁体   中英

SOLR Proximity Search setting

I have some address data that I need to search. I am struggling a bit with the proximity search.

An eg. of address that I am trying to search is:

CATO STREET WEST LAUNCESTON TAS

and my search query for proximity search doesn't return anything when I try to search for (CATO WEST)~2

The configuration for the data field (schema.xml) is as follows:

<field name="street_name_space" type="text_general" indexed="true" stored="true"/>

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

Request handler is as follows:

<requestHandler name="/proximity" class="solr.SearchHandler">
     <lst name="defaults">
     <str name="defType">edismax</str>
        <str name="echoParams">explicit</str>
        <str name="qf">street_name_space</str>
        <str name="qs">10</str>
        <str name="pf">street_name_space</str>
        <str name="ps">10</str>
       <str name="echoParams">explicit</str>
       <str name="fl">street_name, street_name_clean, street_name_space</str>          
     </lst>
    </requestHandler>

Any idea what I shall be doing to get the results?

the KeywordTokenizerFactory you are using keeps the whole thing as a single term, so the only term indexed is 'cato street west launceston tas'. Of course this does not match your query.

Use some other tokenizer, like the WhitespaceTokenizerFactory and it should work

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