简体   繁体   中英

No results returned for any query to Apache Lucene Solr with Simple Schema and index

I am new to SOLR. I'm reading a book from Packt publishing on SOLR and trying to get the exercises up and running. I've come pretty far and figured out quite a bit but I have a long way to go. Currently I've rolled out a test server w/ Digital Ocean (Ubuntu SRVR 14.04) just for practicing here:

http://patrickisgreat.me:8983/solr/#/

I've created one core called privatelounge. I've created a simple schema.xml, solrconfig.xml, and indexed a simple document. I've read a few other threads here like this and this which don't seem to apply to my config.

Here is my schema.xml:

<?xml version='1.0' ?>
<schema name='privatelounge' version='1.1' >
<types>
        <fieldtype name='text_en' class='solr.TextField'>
        <analyzer>
                <tokenizer class='solr.WhitespaceTokenizerFactory' />
                <filter class='solr.LowerCaseFilterFactory' />
        </analyzer>
        </fieldtype>
</types>
<fields>
  <dynamicField name='*' type='text_en' multiValued='true' indexed='true' stored='true' />
    <copyField source='*' dest='fulltext' />
    <field name='fullText' type='text_en' multiValued='true' />
  </fields>
  <defaultSearchField>fullText</defaultSearchField>
  <solrQueryParser defaultOperator='OR' />
</schema>

Here is my solrconfig.xml:

<config>
      <luceneMatchVersion>LUCENE_45</luceneMatchVersion>
      <directoryFactory name='DirectoryFactory' class='solr.MMapDirectoryFactory' />

      <requestHandler name='standard' class='solr.StandardRequestHandler' default='true' />
      <requestHandler name='/update' class='solr.UpdateRequestHandler' />

       <requestHandler name='/admin/' class='org.apache.solr.handler.admin.AdminHandlers' />

      <admin>
       <defaultQuery>*:*</defaultQuery>
      </admin>
</config>

Here is the only document I've indexed:

<add>
<doc>
<field name='title'>Dummy Test Document</field>
<field name='text'>Hello World</field>
</doc>
</add>

Using this command:

sudo curl -X POST 'http://localhost:8983/solr/privatelounge/update?commit=true' -H 'Content-Type: text/xml' -d @docs.xml

So running a query for : returns the document but running a query for any term in fullText using any variation of the query lang returns this:

{
  "responseHeader":{
    "status":0,
    "QTime":4},
  "response":{"numFound":0,"start":0,"docs":[]
  }}

I'm perplexed so far. For anyone willing to help -- I can create an shell account for you on my test server and fax you a corndog, beer, or hug.

Many Thanks!

This works fine for me:

http://patrickisgreat.me:8983/solr/privatelounge/select?q=text%3A%22hello%22&wt=json&indent=true

I get:

{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "response":{"numFound":1,"start":0,"docs":[
      {
        "title":["Dummy Test Document"],
        "fulltext":["Dummy Test Document",
          "Hello World"],
        "text":["Hello World"]}]
  }}

Sure you are entering your query correctly?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM