vincenteof
vincenteof

Reputation: 113

What's default field for query in solr

I am a newcomer for solr, and i have a problem.

Every fieldType definition in managed-schema, you can specify both index analyzer and query analyzer, like this:

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
  <tokenizer class="solr.StandardTokenizerFactory"/>
  <filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
  <filter class="solr.LowerCaseFilterFactory"/>
  <filter class="solr.EnglishPossessiveFilterFactory"/>
  <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  <filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
  <tokenizer class="solr.StandardTokenizerFactory"/>
  <filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
  <filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
  <filter class="solr.LowerCaseFilterFactory"/>
  <filter class="solr.EnglishPossessiveFilterFactory"/>
  <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
  <filter class="solr.PorterStemFilterFactory"/>
</analyzer>

So when i make a query like "q:something", how can i specify the field for "something", and what's the default field for it?

Upvotes: 4

Views: 2831

Answers (1)

Baloo
Baloo

Reputation: 78

You will find default search field in your request handler, You need to check that in conf/solrconfig.xml

Check for "df" parameter,

<str name="df">_text_</str>

OR if you want to query particular field without changing df value then you need specify your query in below format,

fieldname:something

if your query has more than one token you can specify it as ,

fieldname:"something1 something2"

Upvotes: 6

Related Questions