CQL-based result filtering

Issue #9 resolved
Sven Alebrand created an issue

Dear Sir or Madam,

would you consider adding a mechanism to filter search results based on a CQL-query? In our view, this would greatly enhance the possibilities and use-cases with this plugin!

Kind regards
Sven Alebrand

Comments (19)

  1. Instant Search repo owner

    Sven,

    What problem are you trying to solve with the CQL-query?

    It might be possible for me to allow a custom CQL search. Probably easier to do on than the server, but let me know what would make the most sense for you.

    Nathan

  2. Sven Alebrand reporter

    Hey Nathan,

    Thanks for the prompt reply!

    I am trying to offer a search field where only content with a certain metadataset (a set from the „Metadata for Confluence“-app by Communardo) is found. More precisely: I want to offer a full-text search on page contents, but only pages that contain the search term and a certain fixed metadataset shall be returned. „Metadata for Confluence“ supports CQL-queries, see https://communardo.atlassian.net/wiki/spaces/METADATA/pages/27203065/Searching+with+Metadata+v+3.3

    As an example: I‘d like to search for „My text“ in all confluence pages that match the CQL „metadataset=global.metadataset.mymetadataset“.

    Does that help you understand my use-case?

    Sven

  3. Instant Search repo owner

    I think I understand. Are you primarily targeting cloud or data center?

    Also, are you only matching a single set of metadata?

  4. Sven Alebrand reporter

    I am solely targeting data center.

    No, I am not necessarily matching a single set of metadata. Compound CQL-expressions may be necessary, too. E.g.:

    metadataset=global.metadataset.mymetadataset AND global.metadatafield.mytestfield="mytestvalue"
    

  5. Instant Search repo owner

    Okay. Let me do some digging in order for me to make sure that this will be possible with the data center version.

  6. Instant Search repo owner

    (1) Are you able get you query to work for you if you extend the CQL metadata query to the query string?

    i.e., currently I do:

    e.g., my current query string is:

    ((query*) OR (query))

    there are a few other parameters that get handed to the server.

    If you add your CQL to the site search parameter box, do you get the desired results?

    e.g.,

    ‌ ((quer*) OR (quer)) and metadataset=global.metadataset.mymetadataset AND global.metadatafield.mytestfield="mytestvalue"

    if so, it should be pretty straight-forward to do. If not, I’ll have to see if there is a workaround.

    To test my solutions, do I need to use your plugin to insert metadata, or is there another way?

  7. Sven Alebrand reporter

    Yes, inserting the CQL for the metadata search in the query string works. I didn’t even think to test that beforehand.

    I think it would suffice to add any CQL to the query. The metadata search in not specific in any way, you might, for example, just search for content with a specific label and type and the query string like so:

    query AND label = "performance" AND type = "blogpost"
    

  8. Instant Search repo owner

    Great.

    I already allow for things like label and type.

    I’m assuming though that your metadata can be fields that do not exist in confluence ?

  9. Instant Search repo owner

    I use the generic SiteSearch API on the backend. I’ll see if I can’t use the CQL Search engine again: https://docs.atlassian.com/atlassian-confluence/5.9.7/index.html?com/atlassian/confluence/api/service/search/CQLSearchService.html

    Simply appending the CQL query to a generic search string doesn’t quite work, but this should work. Unfortunately, its going to take a bit more writing, but the CQL will allow for more powerful queries anyway.

  10. Instant Search repo owner

    Sorry, this fell off the back-burner. My goal here would be to provide a completely separate query. I’ll put it on my list for this up-coming week / weekend. Sorry for the delay.

  11. Sven Alebrand reporter

    Hey Nathan,

    that’s a pity. Thanks for checking, anyway. I can’t see how ScriptRunner would be helping with this: They don’t provide any kind of live search, do they? Their CQL-Stuff is just “static”, on-page-load-based.

    I’ll keep looking,

    Greetings
    Sven

  12. Instant Search repo owner

    maybe not with live search. Yeah, what you want is a mix of the two. Good luck. The cloud architecture might work better as everything has to be CQL there.

  13. Log in to comment