CF10 Fieldboost on cfindex has no effect

2019-09-15 13:31发布

问题:

Maybe this is a new, mostly unused feature, but I am trying to create a collection based on a query from our DB. It's a simple Q&A and I'd like to rank the matches in the question higher than the answer. Seems logical as currently a search for "register for classes" the question "How do I register for classes" ranks lower than "How to I purchase books for my classes" because content in the books answers I guess matches better. So I'd like to bump the Q&A's if the question matches really well to the text in the query.

CF10 has a "Fieldboost" field on the cfindex however this is having 0 effect on results. I add it and remove it and nothing changes. The score and rank stays the exact same.

<cfindex action="refresh" collection="faq" 
      type="custom" 
      title="question" 
      body="question,answer" 
      fieldboost="question:6" 
      key="faq_id" 
      query="updateQuery" 
      location_i="location_id" />

`

回答1:

So I searched Raymond Camden's site and found a little answer that I thought I had tried earlier, but maybe my syntax was wrong. I am using title:#URL.q#^2 which is working to boost the value of title in the search.

While this works, the CF10 docs indicate I should be able to do this with the fieldboost property, which I still cannot get to work.



回答2:

According to the Solr documentation any field that is to be boosted must have omitNorms="false" in schema.xml. The default is false but is it possible it is being set to true in your schema.xml? The other issue I see in the above CFINDEX statement is that you're not specifying a field name in your fieldboost parameter, but rather a query column. If you want to boost on title then perhaps you need

<cfindex ... fieldboost="title:6" ... />

?