繁体   English   中英

无法针对Solr中的字段进行搜索

[英]Unable to Search Against field in Solr

我无法从solr索引中搜索名为doc_id的特定字段。 我得到的数据来自DB2,而doc_id是表中的PK。

这是数据导入和模式xml

请帮忙

<dataConfig>
  <dataSource driver="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://infbz1051.in.ibm.com:50000/SCION" user="db2admin" password="db2admin" batchSize="10000" readOnly="true" autoCommit="true" transactionIsolation="TRANSACTION_READ_UNCOMMITTED" connectionTimeout="5000000" />
  <document name="socialpost">        
    <entity name="post" pk="doc_id" query="select d.DOC_ID,d.SRC_DOC_ID,d.PARENT_ID,d.SRC_PARENT_ID,d.AUTHOR_ID,d.FORUM,d.CUSTOMER as customer,d.TEXT as post_text,d.text as raw_text,d.URL as doc_url,d.LIKES,d.FWD,d.COMMENTS,a.AUTHOR_ID,a.AUTHOR_NAME,a.EMAIL as author_email,a.AGE as author_age,a.GENDER as author_gender from DOC_DETAILS d,AUTHOR_DETAILS a where d.AUTHOR_ID=a.AUTHOR_ID" deltaImportQuery="select d.DOC_ID,d.SRC_DOC_ID,d.PARENT_ID,d.SRC_PARENT_ID,d.AUTHOR_ID,d.FORUM,d.CUSTOMER,d.TEXT as post_text,d.text as raw_text,d.URL as doc_url,d.LIKES,d.FWD,d.COMMENTS,a.AUTHOR_ID,a.AUTHOR_NAME,a.EMAIL as author_email,a.AGE as author_age,a.GENDER as author_gender from DOC_DETAILS d,AUTHOR_DETAILS a where  d.AUTHOR_ID=a.AUTHOR_ID AND d.doc_id='${dataimporter.delta.DOC_ID}'  with ur" deltaQuery="select DOC_ID from doc_details where lastupdatedtime &gt; '${dataimporter.last_index_time}' with ur">
       <entity name="concept" query="SELECT S.concept as concept FROM SENTIMENT_AND_CONCEPTS S where S.DOC_ID='${post.DOC_ID}' with ur" >
       </entity>
       <entity name="category" query="SELECT ann.doc_id, ann.ANNOTATIONMETAVALUES as category FROM annotations ann where ann.annotator_id=125  and ann.doc_id='${post.DOC_ID}' with ur" >
       </entity>
       <entity name="hcategory" query="SELECT ann.doc_id, ann.ANNOTATIONMETAVALUES as hcategory FROM annotations ann where ann.annotator_id=129  and ann.doc_id='${post.DOC_ID}' with ur" >
       </entity>
       <entity name="tcategory" query="SELECT ann.doc_id, ann.ANNOTATIONMETAVALUES as tcategory FROM annotations ann where ann.annotator_id=127  and ann.doc_id='${post.DOC_ID}' with ur" >
       </entity>
       <entity name="isparent" query="SELECT count(*) as isparent  FROM db2admin.doc_details where doc_id='${post.DOC_ID}' and parent_id=doc_id with ur" >
       </entity>
       <entity name="rankscore" query="select c.CATEGORY_RANK_SCORE as rankscore from CATEGORY_ASSIGNMENT_TABLE c,ANNOTATIONS A where a.doc_id=c.doc_id AND a.ANNOTATIONMETAVALUES =c.category_name AND a.ANNOTATOR_ID=125 and  a.doc_id='${post.DOC_ID}' with ur" >
       </entity>
       <entity name="posttype" query="SELECT ann.doc_id, ann.ANNOTATIONMETAVALUES as posttype FROM annotations ann where ann.annotator_id=35  and ann.doc_id='${post.DOC_ID}' with ur" >
       </entity>
       <entity name="sentimentinfo" query="select c.CATEGORY_SENTIMENT as sentimentinfo from CATEGORY_ASSIGNMENT_TABLE c,ANNOTATIONS A where a.doc_id=c.doc_id AND a.ANNOTATIONMETAVALUES =c.category_name AND a.ANNOTATOR_ID=125 and  a.doc_id='${post.DOC_ID}' with ur" >
       </entity>
    </entity>
  </document>
</dataConfig>

Schema.xml

<field name="doc_id" type="string" indexed="true" stored="true" required="true" multiValued="false"/> 
<field name="customer" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="src_doc_id" type="string" indexed="true" stored="true" omitNorms="true" multiValued="false"/>
<field name="parentid" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="src_parent_id" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="author_id" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="forum" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="timeposted" type="date" indexed="true" stored="true" multiValued="false"/>
<field name="post_text" type="string" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" multiValued="false"/>
<!-- Raw text copy for retrieval convenience --> 
<field name="raw_text" type="string" indexed="true" stored="true" omitNorms="true" termVectors="true" termPositions="true" termOffsets="true" multiValued="true"/>
<copyfield src="post_text" dest="text_raw" />
<field name="url" type="string" indexed="true" stored="true" omitNorms="true" multiValued="false"/>
<field name="likes_fwd_comments" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="lastupdatedtime" type="date" indexed="true" stored="true" omitNorms="true" multiValued="false"/>

SQL非常文字-从中获得的各种SQL结果将具有“ d.DOC_ID”或“ ann.doc_id”之类的列,而不是Solr架构中的“ doc_id”。

在某些SQL字段中确实存在诸如“作为客户”的问题,这意味着,假设整个文档都通过了验证,则标记为“必需”(或uniqueKey)的字段全部存在,等等,则这些特定字段将正常工作。

您的选择语句中的每个字段可能都需要有“ AS xxx”。

如果要搜索使用“ as”语法的字段,请注意,大多数字段都设置为键入“ string”。 在示例模式中,“字符串”类型是StrField,它没有分析功能,因此只能进行精确的全字段或通配符匹配。 您无法在具有StrField类型的多单词字符串中搜索单个单词。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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