简体   繁体   中英

Default proximity search in solr

I was wondering if there is anyway to set up a default search proximity within solr via the solrconfig.xml.

Currently, if I want to perform a proximity search I would have to do the following:

q="red cars"~10

Is there a way to set the 10 word proximity by default so that all queries are proximity searches with a 10 word proximity range?

By using eDismax , you set the proximity as default slop.
The proximity would be enabled by default as the search would look for words that are slop distance apart.

Check Query Phrase Slop and Phrase slop which will set the slop for the queries.
Query Phrase Slop is applied to Phrase Queries.
While, Phrase slop will be applied to normal queries.

<requestHandler name="standard" class="solr.SearchHandler" default="true">
    <lst name="defaults">
        <str name="defType">edismax</str>
        <str name="echoParams">explicit</str>
        <str name="qf">field</str>
        <str name="qs">10</str>
        <str name="pf">field</str>
        <str name="ps">10</str>
        <str name="q.alt">*:*</str>
    </lst>
</requestHandler>

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