MaatDeamon
MaatDeamon

Reputation: 9761

How to add a phrase in a bq in Solr

I would like to boost certain type of documents in my query.

There is a field with the type of document.

In my configuration XML in the bq setting I am adding a boots by type of document.

However, the type of document can be a compound word like "Technical Notes".

I would like to add something like:

bq=type:"Technical Notes"^10 type:"Working Papers"^8

I don't want the term to be sliced in Technical and Notes.

Upvotes: 0

Views: 177

Answers (1)

EricLavault
EricLavault

Reputation: 16065

So you don't want the terms to be tokenized, for that you can set the type of your field to string in schema.xml (so that Solr uses the StrField class, content stream of this type is not analyzed but indexed/stored verbatim) :

<field name="type" type="string" indexed="true" stored="true"/>

Or if you still want to be able to make partial or fuzzy searches within this field, use a copyField instead (copy the field stream into a field that relies on the string fieldType) like :

<copyField source="type" dest="string_type"/>
<field name="string_type" type="string" indexed="true" stored="true"/>

...and make your boost query on this field :

bq=string_type:"Technical Notes"^10 type:"Working Papers"^8

Upvotes: 1

Related Questions