0

I'm just getting started with solr but thought this is somewhat counterintuitive. Please help.

Two of my documents have author = "Rick Riordan". When I run these queries:

Rick

=> returns 2 docs, good!

author:Rick

=> returns nothing.... why?

author:"Rick Riordan"

=> returns 2 docs.... looks like it assumes exact match.

7
  • 2
    show us your schema.xml file Commented Sep 16, 2015 at 6:06
  • 1
    could you share the schema.xml ? Commented Sep 16, 2015 at 6:06
  • schema fragment: { "name":"author", "type":"strings"}, Commented Sep 16, 2015 at 6:08
  • it was created automatically. looks like "strings" type is defined as { "name":"strings", "class":"solr.StrField", "sortMissingLast":true, "multiValued":true}, Commented Sep 16, 2015 at 6:10
  • Type-->Strings. There is a fieldtype tag associated with strings. Paste that in here Commented Sep 16, 2015 at 6:11

2 Answers 2

1

You can use this as a fieldType.

It'll do the following- 1. Generate tokens on white spaces. So that you can either search on individual words or whole word. 2. It will remove duplicate indexes reducing index size.

<fieldType name="strings" class="solr.TextField" sortMissingLast="true" omitNorms="true"> <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <!-- <tokenizer class="solr.KeywordTokenizerFactory"/>--> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </fieldType> 
Sign up to request clarification or add additional context in comments.

Comments

1

Change the field Type for your Field author. Re-index the same and Try Searching the same.

<fieldType> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType> 

fire your query on a field name like below

q=:author:Rick 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.