0
votes

I have a document which has title, stockCode, category fields.

I have different field types (and analysis chains) for each. For instance title has EdgeNGram 2 to 20, category has EdgeNGram 3 to 10 with different range and stockCode just has lowercase filter.

So that, I don't want to search from documents with keyword "sample" with building the query like title:sample OR stockCode:sample OR category:sample.

I'd like to search with just "q=sample".

I copied my fields to text but It does not work. Because all fields analyzed as same. But I don't want to index stockCode as EdgeNGram or any other filters. I'd like to index my fields as I configured and I'd like to search a keyword over them base on my indexes.

I've been researching about that for three days, and Solr has a little bit poor documentation.

1

1 Answers

1
votes

You can use the edismax handler, as this will allow you to give a list of fields to query and supply the query by itself. You can also give separate weights to each field for scoring them differently.

defType=edismax&q=sample&qf=title^10 stockCode category

.. will search for sample in each of the three fields, giving a 10x boost to any hits in the title field.

You can find the documentation about the edismax query parser under Searching in the reference guide.