2 Replies Latest reply on Aug 15, 2011 10:51 AM by jonathandfields

    Query indexes only updated at startup?

    jonathandfields

      Modeshape 2.6.0 Beta2, JBoss AS Kit, Seam web app.

       

      Federated repository with JPA source and file system source.

       

      rebuildQueryIndexOnStartup and queryIndexesRebuiltSynchronously are set to true.

       

      Case 1: queryIndexesUpdatedSynchronously set to true

       

      • I add a STRING property  to a node residing in the JPA source.
      • I perform a full text query with the value of the string property. No results.
      • Using Luke, I can see that the property has not been added to the Lucene document.
      • I restart the server. I perform the same full text search. The node is found.

       

      Case 2: queryIndexesUpdatedSynchronously set to false

       

      • I add a STRING property  to a node residing in the JPA source.
      • I wait for 10 minutes. Hopefully sufficient time for the indexing thread mentioned in the ref guide to do its work.
      • I perform a full text query with the value of the string property. No results.
      • Using Luke, I can see that the property has not been added to the Lucene document.

       

      So overall, it appears that the only time the index is updated is if I restart Modeshape to force a complete index build.

       

      Is this a bug, or am I missing something in my configuration (below)? If it's a bug, and and  I should submit a JIRA, please let me know.

       

      Thanks.

       

       

      modeshape-config.xml

       

      <?xml version="1.0" encoding="UTF-8"?>

      <configuration xmlns:mode="http://www.modeshape.org/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">

          <mode:repositories>

              <mode:repository jcr:name="repository" >

                  <mode:source>federated</mode:source>

                  <mode:options jcr:primaryType="options">

                      <mode:option jcr:name="projectNodeTypes" mode:value="true"/>

                      <mode:option jcr:name="jaasLoginConfigName" mode:value="modeshape"/>

                      <mode:option jcr:name="queryIndexDirectory" mode:value="${jboss.server.data.dir}/modeshape/repositories/store/indexes"/>

                      <mode:option jcr:name="queryIndexesUpdatedSynchronously" mode:value="false"/>

                      <mode:option jcr:name="queryIndexesRebuiltSynchronously" mode:value="true"/>

                      <mode:option jcr:name="rebuildQueryIndexOnStartup" mode:value="always"/>

                  </mode:options>

              </mode:repository>

          </mode:repositories>

       

          <mode:sources jcr:primaryType="nt:unstructured">

              <mode:source jcr:name="database"

                  mode:classname="org.modeshape.connector.store.jpa.JpaSource"

                  mode:dataSourceJndiName="java:DefaultDS"

                  mode:model="Simple"

                  mode:dialect="org.hibernate.dialect.HSQLDialect"

                  mode:referentialIntegrityEnforced="true"

                  mode:largeValueSizeInBytes="10000"

                  mode:retryLimit="3"

                  mode:compressData="false"

                  mode:predefinedWorkspaceNames="default,system"

                  mode:showSql="false"

                  mode:autoGenerateSchema="update"

                  mode:creatingWorkspacesAllowed="true"

                  mode:defaultWorkspaceName="default" />

              <mode:source jcr:name="filesystem"

                  mode:classname="org.modeshape.connector.filesystem.FileSystemSource"

                  mode:description="File System Source"

                  mode:workspaceRootPath="/home/mcr/content"

                  mode:defaultWorkspaceName="default"

                  mode:creatingWorkspacesAllowed="false"

                  mode:rootNodeUuid="a9bb5d79-f6c7-4bbc-a016-9453035b1b87"

                  mode:updatesAllowed="true"

                  mode:exclusionPattern="^.*\.modeshape$"

                  mode:extraPropertiesBehavior="store"/>

              <mode:source jcr:name="federated">

                  <mode:classname>org.modeshape.graph.connector.federation.FederatedRepositorySource</mode:classname>

                  <mode:workspaces>

                      <mode:workspace jcr:name="default">

                          <mode:projections>

                          <mode:projection jcr:name="database projection" mode:source="database" mode:workspaceName="default">

                              <mode:projectionRules>/database => /</mode:projectionRules>

                          </mode:projection>

                          <mode:projection jcr:name="filesystem projection" mode:source="filesystem" mode:workspaceName="default">

                              <mode:projectionRules>/filesystem => /</mode:projectionRules>

                          </mode:projection>

                          </mode:projections>

                      </mode:workspace>

                  </mode:workspaces>

              </mode:source>

          </mode:sources>

      </configuration>

        • 1. Re: Query indexes only updated at startup?
          rhauch

          We have hundreds of integration tests that update content (and save the session) and then verify the indexes are changed, so I'm surprised you are seeing the indexes not be updated. Do you have a small test case (of any kind) that you can share?

          • 2. Re: Query indexes only updated at startup?
            jonathandfields

            I was surprised as well. However, I've confirmed the issue using Luke, and have verified that I am calling session.save(). I suspect that it is something something peculiar to the federated JPA/file system configuration, or to the JBoss AS kit and Seam web app deployment and thus is not appearing in the integration tests. I will work on a small test case, create a JIRA, and attach it to that.