11 Replies Latest reply: Jan 16, 2013 2:27 AM by Yannick Ongena RSS

    Need to add OR condition in cmis query

    879617
      I am trying to retrieve some documents using the cmis query based on a condition where I need to specify the collection Id.To be more clear I have a folder outer within with which I have three subfolders first , second and third , I have a search condition where I need to query all the three subfolders here and bring me the results , but as soon as I start giving the collection ID of the outer most folder It searches only for that folder and does not recursively search the subfolders , So in my query I am trying to add the collection ids of the subfolder in OR condition but i get the error that OR is not a valid operand , AND , ORDER is expected .

      Can any one help me to find if we can write queries with OR condition in UCM?
        • 1. Re: Need to add OR condition in cmis query
          Daniel Merchán
          Hi.

          You can use 'OR' operation without problems.

          To help you please post your query (print it).

          PD: Good way to generate complex CMIS queries and don't get parsing problems are using a Java manage bean.

          Regards.
          • 2. Re: Need to add OR condition in cmis query
            879617
            Hi ,

            Thanks for the reply. I am pasting the query below along with the error mesg.

            SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xCollectionID = '888438448042000024' OR ora:p:xCollectionID = '888438448042000025' OR ora:p:xCollectionID = '888438448042000026' OR ora:p:xCollectionID = '888438448042000027' OR ora:p:xCollectionID = '888438448042000028' OR ora:p:xCollectionID = '888438448042000029' OR ora:p:xCollectionID = '888438448042000217'

            Caused by: oracle.webcenter.doclib.internal.model.presenter.conf.PresenterConfigurationException: oracle.webcenter.content.integration.cmis.query.ParseException: Encountered " "OR" "OR "" at line 1, column 134.
            Was expecting one of:
            <EOF>
            "AND" ...
            "ORDER" ...

                 at oracle.webcenter.doclib.internal.model.presenter.conf.QueryStringDatasource.toSearch(QueryStringDatasource.java:124)
                 at oracle.webcenter.doclib.internal.model.presenter.conf.PresenterDatasource.validate(PresenterDatasource.java:321)
                 ... 90 more
            Caused by: oracle.webcenter.content.integration.cmis.query.ParseException: Encountered " "OR" "OR "" at line 1, column 134.
            Was expecting one of:
            <EOF>
            "AND" ...
            "ORDER" ...

                 at oracle.webcenter.content.integration.cmis.query.CmisQueryParser.generateParseException(CmisQueryParser.java:1288)
                 at oracle.webcenter.content.integration.cmis.query.CmisQueryParser.jj_consume_token(CmisQueryParser.java:1170)
                 at oracle.webcenter.content.integration.cmis.query.CmisQueryParser.cmisQuery(CmisQueryParser.java:80)
                 at oracle.webcenter.content.integration.cmis.query.CmisQueryParser.parseQuery(CmisQueryParser.java:34)
                 at oracle.webcenter.content.integration.cmis.query.CmisSearch.getInstance(CmisSearch.java:61)
                 at oracle.webcenter.doclib.internal.model.presenter.conf.QueryStringDatasource.toSearch(QueryStringDatasource.java:116)
                 ... 91 more
            <AbstractPresenterBean> <getConfiguration()> Jan 14, 2013 7:53:18 PM oracle.webcenter.doclib.internal.model.presenter.conf.PresenterConfigurationException asError
            ALL: Query expression must be a valid, non-empty expression.

            oracle.webcenter.doclib.internal.model.presenter.conf.PresenterConfigurationException: Jan 14, 2013 7:53:18 PM oracle.webcenter.doclib.internal.model.presenter.conf.PresenterConfigurationException asError
            ALL: Query expression must be a valid, non-empty expression.


            I also tried using the 'in clause' like xcollectionId in (<collectionId>,<collectionId>) but still had issues.
            • 3. Re: Need to add OR condition in cmis query
              Daniel Merchán
              Deleted.

              I'll try your query.

              Edited by: Daniel Merchán on 14-ene-2013 14:39
              • 4. Re: Need to add OR condition in cmis query
                Daniel Merchán
                Hi.

                To me is running perfectly SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xCollectionID = '826215362692009339' OR ora:p:xCollectionID = '826215362692013167'

                Are you setting at Design Time or Runtime?

                Regards.
                • 5. Re: Need to add OR condition in cmis query
                  Daniel Merchán
                  "Do not use OR and NOT in Oracle WebCenter Content folder search."

                  http://docs.oracle.com/cd/E23943_01/doc.1111/e15813/toc.htm#CMIWP114

                  Try using ANY operator

                  Regards.
                  • 6. Re: Need to add OR condition in cmis query
                    879617
                    HI Daniel,

                    Thanks for your reply.

                    I am building this query at runtime .

                    Any reason why it may not be working for me .

                    I shall try with the ANY operator.
                    • 7. Re: Need to add OR condition in cmis query
                      Yannick Ongena
                      How do you build it at runtime?
                      What are you doing with the documents? Are you including it in a nav model, content presenter, ... ?
                      • 8. Re: Need to add OR condition in cmis query
                        879617
                        I was not able to use the any operator got error saying should be using only multivalued property.

                        The OR condition works fine if we have only one OR condition else we should format the query with brackets formatted to male sure that only one OR condition is there in outer most query.

                        (((ora:p:xCollectionID = '888438448042000024' OR ora:p:xCollectionID = '888438448042000025') OR (ora:p:xCollectionID = '888438448042000026' OR ora:p:xCollectionID = '888438448042000027')) OR ((ora:p:xCollectionID = '888438448042000028' OR ora:p:xCollectionID = '888438448042000029') OR (ora:p:xCollectionID = '888438448042000217')))
                        • 9. Re: Need to add OR condition in cmis query
                          879617
                          Hi Yanick,

                          I retreive the collection Ids by passing the path to fetch all the subfolders where I need to search for documents and once I get the documents am using a content presenter to display them.
                          • 10. Re: Need to add OR condition in cmis query
                            Yannick.Ongena
                            Sorry... wrong account :)

                            Edited by: 980743 on Jan 16, 2013 12:26 AM
                            • 11. Re: Need to add OR condition in cmis query
                              Yannick Ongena
                              Try this:

                              SELECT cmis:name FROM cmis:document WHERE IN_TREE('folder id')

                              I believe (not 100% sure) that the IN_TREE will return all the children of the specified folder id so you only have to provide the top folder.