Highlighted

Solr default operator woes on CF2018

New Here ,
Dec 04, 2018

Copy link to clipboard

Copied

I am not having any success in changing the Solr defaultOperator to AND so that searches are more like web searches.  If I add an AND between words in my search form, I get what I want.  Without the AND it defaults to OR.

I've changed the defaultOperator  parameter in all the schema.xml files I could find:

\ColdFusion2018\cfusion\jetty\solr\conf\schema.xml

\ColdFusion2018\cfusion\jetty\multicore\collections\CollectionName\conf\schema.xml

I also tried deleting and rebuilding all the collections once the changes to the \ColdFusion2018\cfusion\jetty\solr\conf\schema.xml were made without any joy.  The schema.xml files for each collection had the default set as desired after being deleted and rebuilt, but it still doesn't work right. My recollection is that I had to do this to get the default operator to work right in CF10. 

I'm not seeing any documented changes to <cfsearch> or <cfindex> that should affect this. Ideas anyone?

Views

325

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Solr default operator woes on CF2018

New Here ,
Dec 04, 2018

Copy link to clipboard

Copied

I am not having any success in changing the Solr defaultOperator to AND so that searches are more like web searches.  If I add an AND between words in my search form, I get what I want.  Without the AND it defaults to OR.

I've changed the defaultOperator  parameter in all the schema.xml files I could find:

\ColdFusion2018\cfusion\jetty\solr\conf\schema.xml

\ColdFusion2018\cfusion\jetty\multicore\collections\CollectionName\conf\schema.xml

I also tried deleting and rebuilding all the collections once the changes to the \ColdFusion2018\cfusion\jetty\solr\conf\schema.xml were made without any joy.  The schema.xml files for each collection had the default set as desired after being deleted and rebuilt, but it still doesn't work right. My recollection is that I had to do this to get the default operator to work right in CF10. 

I'm not seeing any documented changes to <cfsearch> or <cfindex> that should affect this. Ideas anyone?

Views

326

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 04, 2018 0
LEGEND ,
Dec 04, 2018

Copy link to clipboard

Copied

The only thing that I can think of would be to alter the search value when submitted.  Replace spaces with a space and a plus sign, to force the AND to be used.

I'm staying away from any CF after CF11.  Once CF11 is EOL, I'm planning on switching to Lucee.

HTH,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 04, 2018 1
New Here ,
Dec 04, 2018

Copy link to clipboard

Copied

Yeah, I thought of doing something like that, but then my colleagues and users will ask "what are all these ANDs about, and why doesn't it just work like Google the way it did before".

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 04, 2018 0
New Here ,
Jan 24, 2019

Copy link to clipboard

Copied

This is still a problem for me (the OP).  The DisMax Query Parser in Solr has a bunch of settings (see The DisMax Query Parser | Apache Solr Reference Guide 6.6 ).  The default for 'mm' or 'minimum should match' parameter looks like this in the ACF 2018 solrconfig.xml file:

  <str name="mm">

        2&lt;-1 5&lt;-2 6&lt;90%

  </str>

I tried changing this to:

  <str name="mm">

        100%

  </str>

I restarted CF, but still no change in how the default operator works.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 24, 2019 0
New Here ,
Feb 17, 2020

Copy link to clipboard

Copied

This drove me nuts for quite a while.  What finally worked for me was to change the parser type parameter to type="DisMax" (the default is "Standard").  I left the defaultOperator parameters set to "AND" and it worked with DisMax. The defaultOperator parameter appears to be deprecated, so I don't know if that made any difference.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 17, 2020 0