How do I search for content properties from the Confluence Server search screen?
Asked by Elie Daou:

Hello,

I'm trying to reproduce what is being done in this blog post on Confluence Server (this article describes the process required for Confluence Connect):  
<https://developer.atlassian.com/blog/2016/01/confluence-connect-integrations-with-CQL/>

I've been able to:

* index the content properties, by following this guide:  
  <https://developer.atlassian.com/blog/2015/02/confluence-5-7-apis/>  

  I get results when I search for the content properties using the REST API:  

  ![rest-search.png](/t5/image/serverpage/image-id/2334iD4867593217B158E/image-size/large?v=v2&px=999 "rest-search.png")
* create a CQL field in the search screen by following this guide: <https://developer.atlassian.com/confdev/tutorials/adding-a-field-to-cql>  

  ![fileid-cql-field.png](/t5/image/serverpage/image-id/2335i08FD83FAC16B098C/image-size/large?v=v2&px=999 "fileid-cql-field.png")

What I can't figure out is how to connect these two things together:  
how can I search for the content properties from the Confluence Search screen?

![failed-search.png](/t5/image/serverpage/image-id/2336i689BA54B8285D6BF/image-size/large?v=v2&px=999 "failed-search.png")

Ultimately, I'd like to have an alias for the CQL content property field like in the blog post above (instead of using the "content.property\[key\].value" syntax).

Here's my atlassian-plugin.xml:

```
<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">    <plugin-info>        <description>${project.description}</description>        <version>${project.version}</version>        <vendor name="${project.organization.name}" url="${project.organization.url}" />        <param name="plugin-icon">images/pluginIcon.png</param>        <param name="plugin-logo">images/pluginLogo.png</param>    </plugin-info>    <!-- add our i18n resource -->    <resource type="i18n" name="i18n" location="search"/>        <!-- add our web resources -->    <web-resource key="search-resources" name="search Web Resources">        <dependency>com.atlassian.auiplugin:ajs</dependency>                <resource type="download" name="search.css" location="/css/search.css"/>        <resource type="download" name="search.js" location="/js/search.js"/>        <resource type="download" name="images/" location="/images"/>        <context>search</context>    </web-resource>    <content-property-index-schema key="mxdoc-schema-module-key">        <key property-key="mxdoc">            <extract path="fileid" type="number"/>        </key>    </content-property-index-schema>    <cql-query-field fieldName="fileid" key="mxdoc-fileid-field"                     name="FileID" class="doc.confluence.search.FileIdHandler">        <ui-support value-type="number" i18n-key="cql.field.fileid"/>    </cql-query-field></atlassian-plugin>
```

Here's the Java code I've written so far (I'm not sure how to reference content properties from within the plugin code):

```
public class FileIdHandler extends BaseFieldHandler implements NumericFieldHandler<V2SearchQueryWrapper> {    private static final String FILEID_FIELD = "fileid";    public FileIdHandler() {        super(FILEID_FIELD, true);    }    public V2SearchQueryWrapper build(RangeExpressionData rangeExpressionData, String value) {        validateSupportedOp(rangeExpressionData.getOperator(),                newHashSet(LESS, LESS_OR_EQUALS, NOT_EQUALS, EQUALS, GREATER_OR_EQUALS, GREATER));        return wrapV2Search(new TermQuery(FILEID_FIELD, value), rangeExpressionData);    }}
```

Thanks!


Answers:
author: Hakeem Olasupo
body: This should help

<https://confluence.atlassian.com/doc/confluence-search-syntax-158720.html>


Tags: cql

property

search

server