title: How are Solr fields mapped in Spring Data Solr?
body: <p>I'm trying to use Spring Data Solr to query stuff from a backend Solr server, which has the following <code>schema.xml</code> (showing you just the fields for simplicity), which was copied from the Nutch <code>schema.xml</code>. This means that I've crawled the web using Nutch and then passed the segments to Solr:</p>
  
  <pre><code>...
  
  &lt;fields&gt;
  
      &lt;!--APPARENTLY THE ONLY FIELD WHICH IS REQUIRED!!! --&gt;
      &lt;field name="id" type="string" stored="true" indexed="true" required="true"/&gt;
  
      &lt;field name="_version_" type="long" indexed="true" stored="true"/&gt;
  
      &lt;!-- core fields --&gt;
      &lt;field name="segment" type="string" stored="true" indexed="false"/&gt;
      &lt;field name="digest" type="string" stored="true" indexed="false"/&gt;
      &lt;field name="boost" type="float" stored="true" indexed="false"/&gt;
  
      &lt;!-- fields for index-basic plugin --&gt;
      &lt;field name="host" type="url" stored="false" indexed="true"/&gt;
      &lt;field name="url" type="url" stored="true" indexed="true"/&gt;
      &lt;!-- stored=true for highlighting, use term vectors  and positions for fast highlighting --&gt;
      &lt;field name="content" type="text_general" stored="true" indexed="true"/&gt;
      &lt;field name="title" type="text_general" stored="true" indexed="true"/&gt;
      &lt;field name="cache" type="string" stored="true" indexed="false"/&gt;
      &lt;field name="tstamp" type="date" stored="true" indexed="false"/&gt;
  
      &lt;!-- fields for index-geoip plugin --&gt;
      &lt;field name="ip" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="cityName" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="cityConfidence" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="cityGeoNameId" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="continentCode" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="continentGeoNameId" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="contentName" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="countryIsoCode" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="countryName" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="countryConfidence" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="countryGeoNameId" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="latLon" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="accRadius" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="timeZone" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="metroCode" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="postalCode" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="postalConfidence" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="countryType" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="subDivName" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="subDivIsoCode" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="subDivConfidence" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="subDivGeoNameId" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="autonSystemNum" type="int" stored="true" indexed="true"/&gt;
      &lt;field name="autonSystemOrg" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="domain" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="isp" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="org" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="userType" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="isAnonProxy" type="boolean" stored="true" indexed="true"/&gt;
      &lt;field name="isSatelitteProv" type="boolean" stored="true" indexed="true"/&gt;
      &lt;field name="connType" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="location" type="location" stored="true" indexed="true"/&gt;
  
      &lt;dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/&gt;
  
      &lt;!-- catch-all field --&gt;
      &lt;field name="text" type="text_general" stored="false" indexed="true" multiValued="true"/&gt;
  
      &lt;!-- fields for index-anchor plugin --&gt;
      &lt;field name="anchor" type="text_general" stored="true" indexed="true" multiValued="true"/&gt;
  
      &lt;!-- fields for index-more plugin --&gt;
      &lt;field name="type" type="string" stored="true" indexed="true" multiValued="true"/&gt;
      &lt;field name="contentLength" type="string" stored="true" indexed="false"/&gt;
      &lt;field name="lastModified" type="date" stored="true" indexed="false"/&gt;
      &lt;field name="date" type="tdate" stored="true" indexed="true"/&gt;
  
      &lt;!-- fields for languageidentifier plugin --&gt;
      &lt;field name="lang" type="string" stored="true" indexed="true"/&gt;
  
      &lt;!-- fields for subcollection plugin --&gt;
      &lt;field name="subcollection" type="string" stored="true" indexed="true" multiValued="true"/&gt;
  
      &lt;!-- fields for feed plugin (tag is also used by microformats-reltag)--&gt;
      &lt;field name="author" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="tag" type="string" stored="true" indexed="true" multiValued="true"/&gt;
      &lt;field name="feed" type="string" stored="true" indexed="true"/&gt;
      &lt;field name="publishedDate" type="date" stored="true" indexed="true"/&gt;
      &lt;field name="updatedDate" type="date" stored="true" indexed="true"/&gt;
  
      &lt;!-- fields for creativecommons plugin --&gt;
      &lt;field name="cc" type="string" stored="true" indexed="true" multiValued="true"/&gt;
  
      &lt;!-- fields for tld plugin --&gt;
      &lt;field name="tld" type="string" stored="false" indexed="false"/&gt;
  
      &lt;!-- field containing segment's raw binary content if indexed with -addBinaryContent --&gt;
      &lt;field name="binaryContent" type="binary" stored="true" indexed="false"/&gt;
  
  &lt;/fields&gt;
  
  ...
  </code></pre>
  
  <p>Now, looking at the documentation for Spring Data Solr, for example here:</p>
  
  <blockquote>
    <p><a href="http://docs.spring.io/spring-data/solr/docs/1.4.x/reference/html/#reference" rel="nofollow noreferrer">http://docs.spring.io/spring-data/solr/docs/1.4.x/reference/html/#reference</a></p>
  </blockquote>
  
  <p>The methods and fields that they use do not seem to match with my fields in my schema. For example, in the docs they have:</p>
  
  <pre><code>public interface ProductRepository extends Repository&lt;Product, String&gt; {
    List&lt;Product&gt; findByNameAndPopularity(String name, Integer popularity);
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>public interface ProductRepository extends SolrRepository&lt;Product, String&gt; {
    @Query("inStock:?0")
    List&lt;Product&gt; findByAvailable(Boolean available);
  }
  </code></pre>
  
  <p>And looking at my fields I don't have either a field called "name",  "popularity" or "available". What am I missing? Should I change my schema? Should I change repositories from the docs? </p>
  
  <p>This last question seems stupid, but since the examples I've seen around using Spring Data Solr only create a <code>Product</code> model (I know it's an example, but examples usually reflect default cases!) with its corresponding Solr repository and they usually contain fields such as "name", "popularity", "author", I'm not sure what do these fields actually stand for or are mapped to. </p>