2016-05-01 101 views
0

我已经上传和Solr中提取6.0.0的文件,我看到它使用了下面的查询索引:Solr的搜索无法正常工作

http://localhost:8983/solr/techproducts/select?indent=on&q=id:doc1&wt=json

{ 
    "responseHeader":{ 
    "status":0, 
    "QTime":1, 
    "params":{ 
     "q":"id:doc1", 
     "indent":"on", 
     "wt":"json"}}, 
    "response":{"numFound":1,"start":0,"docs":[ 
     { 
     "links":["http://www.education.gov.yk.ca/"], 
     "id":"doc1", 
     "last_modified":"2008-06-04T22:47:36Z", 
     "title":[" PDF Test Page"], 
     "content_type":["application/pdf"], 
     "author":"Yukon Canada Yukon Department of Education", 
     "author_s":"Yukon Canada Yukon Department of Education", 
     "content":[" \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n PDF Test Page \n \n \n \n \nPDF Test File \n \nCongratulations, your computer is equipped with a PDF (Portable Document Format) \nreader! You should be able to view any of the PDF documents and forms available on \nour site. PDF forms are indicated by these icons: or . \n \nYukon Department of Education \nBox 2703 \nWhitehorse,Yukon \nCanada \nY1A 2C6 \n \nPlease visit our website at: http://www.education.gov.yk.ca/\n \n \n \n \n "], 
     "_version_":1533049305513852928}] 
    }} 

我请参阅该字段内容有多个出现字PDF

为什么我没有得到的结果与下面的查询,当有一个字段名称content它包含PDF ?:

select?q=*:*&fq=content:PDF 

{ 
    "responseHeader":{ 
    "status":0, 
    "QTime":4, 
    "params":{ 
     "q":"*:*", 
     "indent":"on", 
     "fq":"content:PDF", 
     "rows":"50", 
     "wt":"json"}}, 
    "response":{"numFound":0,"start":0,"docs":[] 
    }} 

里面当我查询中使用不同的领域,例如title,那我也正确的结果:

select?q=*:*&fq=title:PDF 

{ 
    "responseHeader":{ 
    "status":0, 
    "QTime":3, 
    "params":{ 
     "q":"*:*", 
     "indent":"on", 
     "fq":"title:PDF", 
     "rows":"50", 
     "wt":"json"}}, 
    "response":{"numFound":1,"start":0,"docs":[ 
     { 
     "links":["http://www.education.gov.yk.ca/"], 
     "id":"doc1", 
     "last_modified":"2008-06-04T22:47:36Z", 
     "title":[" PDF Test Page"], 
     "content_type":["application/pdf"], 
     "author":"Yukon Canada Yukon Department of Education", 
     "author_s":"Yukon Canada Yukon Department of Education", 
     "content":[" \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n PDF Test Page \n \n \n \n \nPDF Test File \n \nCongratulations, your computer is equipped with a PDF (Portable Document Format) \nreader! You should be able to view any of the PDF documents and forms available on \nour site. PDF forms are indicated by these icons: or . \n \nYukon Department of Education \nBox 2703 \nWhitehorse,Yukon \nCanada \nY1A 2C6 \n \nPlease visit our website at: http://www.education.gov.yk.ca/\n \n \n \n \n "], 
     "_version_":1533049305513852928}] 
    }} 
+0

请你分享schema.xml中... –

回答

0

检查schema.xml为内容field定义的field type

比较内容和标题字段的字段类型。

可能是您没有为您的字段内容定义适当的字段类型。这些字段类型不会为您的文本生成任何标记,或者必须将整个文本视为一个整体。如果您在字段中使用keywordtokenizerstring字段类型,则会发生这种情况。

您可以勾选相同的检查或分析Solr调试工具。

在这里您可以检查文本是如何编制索引以及如何搜索文本的。

如果您想在field上搜索,那么您必须提及属性indexed=true,并且您希望solr返回相同的值,然后您需要添加stored=true

这两个attribute帮助您实现搜索和检索字段的原始值

+0

我有以下的托管模式:<字段名=“内容“type =”text_general“indexed =”false“stored =”true“multiValued =”true“/> and 。那么我应该将内容字段的索引属性更改为true并重新启动sorl服务器? – user1563721

+0

我将其更改为true并且没有更改...我仍无法搜索“内容”字段。 – user1563721

+0

更改后..您需要重新启动服务器并重新索引数据.. –

相关问题