I'm new to Solr. Using Solr 1.4.1

I have a schema.xml that have this fields:

job_title
job_description
date_inserted

I need to give more importance to the "job_title" field. If for example I'm searching for the word "programmer" I need to show in the first place the results that have "programmer" in the "job_title" field ordered by date, then the results that have the word "programmer" in the "job_description" field.

It is possible to user order by date and boost together?

Please give me some clues on what I need to pay attention to do this.

Best Regards,

有帮助吗?

解决方案

It is possible to use order by date and boost together?

No. Boosting relies on the default sorting by score desc. Setting a different sort field overrides sorting by scoring, therefore they're exclusive.

I need to show in the first place the results that have "programmer" in the "job_title" field ordered by date, then the results that have the word "programmer" in the "job_description" field.

If you really want to do that, it's two queries: one by job_title, another by job_description. But that's not how things are usually done in Solr. You run a single query with the appropriate boosting to influence scoring (instead of sorting), where you could for example use function queries to boost newer documents.

Then you give the user the option to sort by date or whatever field. As explained before, when the user sorts, he overrides any scoring and boosting.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top