1

I'm trying to get free-text search results from indexed data with solr 4.5 using Dismax Query Parser but no results returning and no errors with simple queries like this:

http://localhost:9999/solr/products/select?q=cuir&qf=text_fr&defType=dismax

And these documents are exists in index:

{ id: 1, label: "Sac à main en cuir" }
{ id: 2, label: "Sac à main en cuir rouge" }

My schema.xml is:

..
<field name="id" type="int" indexed="true" stored="true" required="true" /> 
<field name="label" type="string" indexed="true" stored="true" required="true" />
...
<copyField source="label" dest="label_fr"/>
<dynamicField name="*_fr" type="text_fr" indexed="true" stored="false" />
...
<fieldType name="text_fr" class="solr.TextField" positionIncrementGap="100">
  <analyzer> 
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_french.txt" enablePositionIncrements="true" />
    <filter class="solr.SnowballPorterFilterFactory" language="French"/>
    <filter class="solr.CollationKeyFilterFactory" language="fr" strength="primary" />
  </analyzer>
</fieldType>

and in solrconfig.xml

...
<requestHandler name="/select" class="solr.SearchHandler">
  <lst name="defaults">
    <str name="echoParams">explicit</str>
    <int name="rows">10</int>
    <str name="defType">dismax</str>
  </lst>
 ...

So any ideas what is wrong? Why there are no results?

1
  • You can use the analysis tool that comes with Solr and debug. You can access it at http://HOST:PORT/solr/#/CORE/analysis Commented Oct 30, 2013 at 22:14

2 Answers 2

2

KeywordTokenizer treats your whole index string as a single token, so it won't match to a single word query.

Instead, you may try StandardTokenizerFactory, or WhitespaceTokenizerFactory, or WordDelimiterFilter.

Sign up to request clarification or add additional context in comments.

Comments

0

In the above schema you've defined the field "label" as "string" and it is treating it as a single string

You Should change the fieldType to :

<field name="label" type="text_general" indexed="true" stored="true" required="true" />

And as mentioned above the text_general fieldType by default has the StandardTokenizerFactory configured.

It'll treat the field as text (or strings) and you will be able to perform full-text search on it.

Note : FieldType String is good in case of faceted search for a particular category in that case you must use String for better results. or you can do a CopyField.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.