1 Reply Latest reply on Oct 28, 2013 3:54 AM by hchiorean

    Modeshape get queryResult repository and Indexing

    fazileh

      I 'm using modeshape-3.4.0.Final on my application that installed on a server desktop pc, and many clients connect to that. In my code, Before I had use path (/users/nodes) for get nodes, but now I want to run a query on existing nodes. It's a simple query, but It does not have any result in run mode, While the in debug mode has the expected result. I searched a lot and I found this post: Re: Querying a repository and this quotes:

      One quirk of ModeShape is that, upon the first startup, index the entire repository content so that searching and queries will work. If there is already content (e.g., existing files on the file system used by your file system connector), then this may take a while, depending upon the size of the content. If you are submitting your queries before this indexing finishes (or even before the first batch of indexing completes), there will be nothing in the indexes and thus nothing in the results.

      I tried a wait(30000) in my code, and result fetch correctly.If I'm not mistaken, I guess my problem is INDEXING.
      I don't have any setting for indexing in my json file. my repository json file is:

      {

          "name" : "MyRepository",

          "transactionMode" : "auto",

          "monitoring" : {

              "enabled" : true,

              },

          "workspaces" : {

              "predefined" : ["otherWorkspace"],

              "default" : "my_wsp",

              "allowCreation" : true

          },

          "security" : {

              "anonymous" : {

                  "roles" : ["readonly","readwrite","admin"],

                  "useOnFailedLogin" : false

              }

          },

          "storage" : {

              "cacheName" : "MyRepository",

              "cacheConfiguration" : "${user.home}/.MyRep/infinispan_configuration.xml",

              "binaryStorage" : {

                    "type" : "file",

                    "directory" : "${user.home}/MyStorage/MyRepository",

                    "minimumBinarySizeInBytes" : 4096

                }

            }

      }

      I want to know Do I have to add "query":{} part to my json file? like this:

      "query" : {

              "enabled" : true,

              "indexStorage" : {

                  "type" : "filesystem",

                  "location" : "/path/on/filesystem",

                  "lockingStrategy" : "simple",

                  "fileSystemAccessType" : "auto"

              },

              "indexing" : {

                  "rebuildOnStartup": {

                      "when" : "if_missing",

                      "includeSystemContent": true,

                      "mode": async

                  },

                  "threadPool" : "modeshape-workers",

                  "analyzer" : "org.apache.lucene.analysis.standard.StandardAnalyzer",

                  "similarity" : "org.apache.lucene.search.DefaultSimilarity",

                  "indexFormat" : "LUCENE_CURRENT",

                  "readerStrategy" : "shared",

                  "backend" : {

                      "type" : "lucene"

                  },

                  "batchSize" : -1,

                  "mode" : "sync",

                  "asyncThreadPoolSize" : 1,

                  "asyncMaxQueueSize" : 0

              },

          },

      Is it enough, or I have to change current repository!?

      Thanks in advance

        • 1. Re: Modeshape get queryResult repository and Indexing
          hchiorean

          In ModeShape queries are enabled by default but indexes are stored in RAM. In a real system we recommend at least that indexes are stored on persistent media so that they survive repository restarts. This means that at least you should have something similar to:

          "query" : {

                  "indexStorage" : {

                      "type" : "filesystem",

                      "location" : "/path/on/filesystem",

                  }

              }


          Depending on your context (i.e. query responsiveness right after startup) you may want to also fine-tune the "rebuildOnStartupOptions". The fragment you pasted above shows the default values.


          I don't know that what "run mode" and "debug mode" mean for your application, but there are several reasons you might not be getting query results:

          * the query is correct syntactically, but incorrect semantically

          * you are storing indexes in RAM (the default option) and expect to find data across repository restarts


          Also, we recommend updating to 3.6.0.Final which contains numerous bug fixes.