Uploaded image for project: 'Spring Data for Apache Solr'
  1. Spring Data for Apache Solr
  2. DATASOLR-119

query result entity have another entity's result

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0 M1
    • Fix Version/s: None
    • Component/s: Repository
    • Labels:
      None
    • Environment:
      JDK 7.0, Spring data solr 1.1.0.BUILD-SNAPSHOT

      Description

      1、I create 2 class:DocumentEntity and KnowledgeEntity;

      2、user solr db-data-config.xml like this:

      <dataConfig>
      	<dataSource driver="com.mysql.jdbc.Driver"
      		url="jdbc:mysql://localhost:3306/my_db?useUnicode=true&amp;characterEncoding=UTF-8"
      		user="root" password="root" />
      	<document>
      		<entity name="documentEntity" query="SELECT * FROM sys_document">
      			<field column="id" name="id" type="string" indexed="true"
      				stored="true" required="true" />
      			<field column="title" name="title" type="string" indexed="true"
      				stored="true" required="true" />
      			<field column="content" name="content" type="string" indexed="true"
      				stored="true" required="true" />
      		</entity>
      
      		<entity name="knowledgeEntity" query="SELECT * FROM sys_knowledge">
      			<field column="id" name="id" type="string" indexed="true"
      				stored="true" required="true" />
      			<field column="title" name="title" type="string" indexed="true"
      				stored="true" required="true" />
      			<field column="keyword" name="keyword" type="string" indexed="true"
      				stored="true" required="true" />
      			<field column="publish_date" name="publishDate" type="date"
      				indexed="true" stored="true" required="true" />
      			<field column="content" name="content" type="string" indexed="true"
      				stored="true" required="true" />
      		</entity>
      	</document>
      </dataConfig>
      

      3、user solr import all data like this:
      http://localhost:8080/solr/dataimport?command=full-import

      4、query in solr like this:
      http://localhost:8080/solr/select?q=title:*Tom*

      the result list contains DocumentEntity and KnowledgeEntity data;

      5、use Spring Data Solr to query KnowledgeEntity like this:

      @Highlight(fields = { "name", "keyword", "contents" })
      	public HighlightPage<KnowledgeEntity> searchByKeyword(HighlightQuery query) {
      
      		SolrOperations so = getSolrOperations();
      
      		return so.queryForHighlightPage(query, KnowledgeEntity.class);
      	}
      

      the result list's entity is KnowledgeEntity, but also contains DocumentEntity and KnowledgeEntity data;

      I hope it can be resolved quickly!Because it affect system's availability.

      Thank you!

        Attachments

          Activity

            People

            • Assignee:
              cstrobl Christoph Strobl
              Reporter:
              xinggg22 JetsonLee
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: